← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 691442] [NEW] The TTFSearchPath changed at outside module is ignored

 

On Friday 17 December 2010, you wrote:
> Public bug reported:
> 
> There are 3 variable defined in report.render.rml2pdf.customfonts module:
> TTFSearchPath_Linux, TTFSearchPath_Windows, TTFSearchPath_Darwin, all
> refers to tuple object. They are refereed in the TTFSearchPathMap dict
> like below: TTFSearchPathMap = {
>     'Darwin': TTFSearchPath_Darwin,
>     'Windows': TTFSearchPath_Windows,
>     'Linux': TTFSearchPath_Linux,
> }
> 
> 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:
  from report.render.rml2pdf import customfonts as cfonts
  cfonts.TTFSearchPath_Linux = cfonts.TTFSearchPath_Linux + ( '/my/path',)
it wouldn't work. 
However, I would still expect this to work:
  cfonts.TTFSearchPathMap['Linux'] = cfonts.TTFSearchPath_Linux + ( '/my/path',)

Note, however, that after any modification, you would better need to re-issue:
  cfonts.FindCustomFonts()
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.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/691442

Title:
  The TTFSearchPath changed at outside module is ignored

Status in OpenObject Server:
  New

Bug description:
  There are 3 variable defined in report.render.rml2pdf.customfonts module: TTFSearchPath_Linux, TTFSearchPath_Windows, TTFSearchPath_Darwin, all refers to tuple object. They are refereed in the TTFSearchPathMap dict like below:
TTFSearchPathMap = {
    'Darwin': TTFSearchPath_Darwin,
    'Windows': TTFSearchPath_Windows,
    'Linux': TTFSearchPath_Linux,
}

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





References