The TTFSearchPath changed at outside module is ignored
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Invalid
|
Undecided
|
OpenERP's Framework R&D |
Bug Description
There are 3 variable defined in report.
TTFSearchPathMap = {
'Darwin': TTFSearchPath_
'Windows': TTFSearchPath_
'Linux': TTFSearchPath_
}
If at later time I make 3 TTFSearchPath variable refers to other tuple object (eg. change the search path), these changes won't affect the TTFSearchPath* in TTFSearchPathMap dict, as they are still refered to the original tuple object.
I propose to replace immutable tuple to list, thus all changes to these variable will count in the later process.
patch is attached
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
status: | New → Confirmed |
Changed in openobject-server: | |
importance: | Low → Undecided |
On Friday 17 December 2010, you wrote: render. rml2pdf. customfonts module: Linux, TTFSearchPath_ Windows, TTFSearchPath_ Darwin, all Darwin, Windows, Linux,
> Public bug reported:
>
> There are 3 variable defined in report.
> TTFSearchPath_
> refers to tuple object. They are refereed in the TTFSearchPathMap dict
> like below: TTFSearchPathMap = {
> 'Darwin': TTFSearchPath_
> 'Windows': TTFSearchPath_
> 'Linux': TTFSearchPath_
> }
>
> If at later time I make 3 TTFSearchPath variable refers to other tuple
> object (eg. change the search path), these changes won't affect the
> TTFSearchPath* in TTFSearchPathMap dict, as they are still refered to
> the original tuple object.
>
> I propose to replace immutable tuple to list, thus all changes to these
> variable will count in the later process.
>
> patch is attached
>
Well, you may be right. If your module calls: render. rml2pdf import customfonts as cfonts TTFSearchPath_ Linux = cfonts. TTFSearchPath_ Linux + ( '/my/path',) TTFSearchPathMa p['Linux' ] = cfonts. TTFSearchPath_ Linux + ( '/my/path',)
from report.
cfonts.
it wouldn't work.
However, I would still expect this to work:
cfonts.
Note, however, that after any modification, you would better need to re-issue: FindCustomFonts ()
cfonts.
because there is a slight chance that this function had been called before your
module's code is executed, and then it wouldn't consult the paths again.