Re: [Cheetahtemplate-discuss] Problems with SettingsManager
Brought to you by:
rtyler,
tavis_rudd
From: Larry S. <la...@li...> - 2007-04-20 14:32:35
|
Mike Orr wrote: > > It's preferable to build the search list before instantiating the > template, but if you must add a namespace inside the template: > > #silent self.searchList().insert(0, my_dict) That's essentially what I was doing at first, then I just moved the use of the SettingsManager into my driver script. > As for building the dicts, that's not really a Cheetah issue. You can > use SettingsManager, ConfigParser, that ConfigParser enhancement whose > name I can't remember, email headers (using the email package), etc. > One cool way is execfile: write a quasi Python module and use execfile > to load it into a dict. If you have to teach somebody a new syntax > anyway, teaching them Python syntax is not that big a leap. Just have > them do simple variable assignments with triple-quoted strings. That > way they won't have to do anything special if the value spans multiple > lines or contains quotes. Excellent - that's exactly what I needed. The execfile method is much superior to SettingsManager for one key reason - multiline strings do not end up coming out with embedded \n characters, they come out as multiple lines, which is what I want. Thanks for pointing me at this (even if it wasn't a cheetah specific problem). You've really helped me out. Larry. |