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:
>
> Explanation:
> I've just been fiddling about with this for hours. Annoying stuff this is.
>
> It seems mod_python and twisted store/remember/cache stuff between
> requests.
>
> Take the following example:
>
> def cb_prepare(args):
>    request = args["request"]
>    data = request.getData()
>
>    if len(data["entry_list"]) == 0:
> 	data['my_message'] = "no entries"
>    elif len(data["entry_list"]) == 1:
> 	data['my_message'] = "single entry"
>    else:
> 	data['my_message'] = "multiple entries"
>
>
> Now when I click arround the blog, viewing multiple entries, then a
> single entry then again multiple entries. The variable 'my_message' will
> change randomly. Doing a page reload on a single entry once shows
> "single entry", after the next reload it shows "multiple entries", after
> the next reload "single entry" and so on.
>
> As for mod_python I guess this happens cause the different requests get
> served by different apache subprocesses and therefore different python
> interpreters. Alltough it still doesn't make sense.
>
> As for twisted I have no idea why this happens.
>
> ...
>
> As a new data dict get's created for every request I really don't 
> understand what's going on here. Totaly weird this is. Anybody got an 
> idea why this is happening?

Are you running any other plugins other than the one with the code above?

I agree with you that this shouldn't happen in theory.  But I'd have to 
trace the data dict throughout PyBlosxom to verify that.

It might be interesting to print out the object id of the Request object 
in addition to your "single entry"/"multiple entries".  Part of me wonders 
whether that's getting shared or not.

/will


-------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.