Re: Proposal: write plugins as classes
will guaraldi <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 1 Apr 2005, Steven Armstrong wrote: > On 04/01/05 05:19, will guaraldi wrote: >> On Fri, 1 Apr 2005, Steven Armstrong wrote: >> >> That's actually not true. If you look at some of the contributed plugins >> we have, there are two methods for storing data between callbacks: >> >> 1. store data in the data dict (this is what it's for) >> 2. create an instance of the class and store that in the data dict. >> pycategories and friends work this way. >> 3. store stuff on the module level associated with a specific request > > re 3. > I was thinking about servers that cache loaded modules (e.g. > mod_python). This is the reason I started storing stuff in the data dict > instead of module level vars. Constants are not a problem, just talking > about state and temp vars. Well, the key is the part where i say "associated with a specific request". If you do that, then module level storage is ok. So in the module you'd have a dict and the keys of the dict would be the request object, and the value would be whatever you wanted to store. I don't think I've seen anyone do this, but it is possible to do and I think it'd work fine. >> The first and second are "well established" mechanisms and they were >> documented in several places on the wiki and on my blog. > > Ups. Thanks for not just saying RTFM ;-) Well, the wiki is down and I don't really consider my blog to be "good documentation". This is stuff that I need to move to the manual, but haven't gotten to it yet. Getting there.... /will ------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/Info/Sentarus/hamr30