Re: config -> data overloading (was Re: docs: how to upgrade plugins for 1.2)
will guaraldi <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 28 Feb 2005, Steven Armstrong wrote: > > Anyway, this issue pointed me to another problem. > > In the wiki [1] someone points out that the way config and data are > overloaded (he calls it shadowed in the wiki) is inconsistent, and he's > right. > > In the default blosxom renderer, while processing head and foot > templates, data overloads config, which IMHO makes sense. But while > processing entries, config overloads data. > > I'ld like to propose the following rules/changes: > - Pyblosxom should treat the config dict as static final constants and > not change it at all. > - any changes that need to be done to variables which are defined in > config should be stored in data. > - data should always overload config. Hrm... That gets a little dicey. It would require plugins to check the data dict for variables they might need and if it's not in there, check the config dict. Right now, we change values in the config dict as we go through processing. I think (and this may be incorrect) we have a copy of the config dict for each Request object--so our modified version isn't shared between requests. If that's not true, we need to fix that soon. Hmmm... I like the idea of having a static final config dict. Maybe the data dict should start out as a copy of the config dict. Then we fix everything to manipulate and query the data dict and only look at the config dict when we absolutely have to have the original values--and even then we won't write to or modify the config dict. It'll be a pain in the ass to update all the plugins out there. This would constitute an API change. Out of curiosity, other than a consistency issue which seems pretty minor in the grand scheme of things, is there any other reason why what we're doing now is bad? /will -- whatever it is, you can find it at http://www.bluesock.org/~willg/ except Will--you can only see him in real life. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click