[Zope-CMF] Re: Odd behavior with lazy ActionInfo evaluation in CMF 1.5

Raphael Ritz r.ritz at biologie.hu-berlin.de
Fri Jul 1 03:31:00 EDT 2005


Alec Mitchell wrote:

[nice analysis cut]

> The above steps are the expected behavior, and appear to work perfectly.  The 
> strange part follows:
> 
> 5) 'portlet_login' gets the url for the action using "[a['url'] for a in 
> actions['user'] if a['id']=='join']".

Shouldn't this be something like:

here.portal_registration.getActionInfo('user/join')['url']

now?

Raphael


> 6) This results in another call to ActionInfo.__getitem__ on what should be 
> the same ActionInfo instance.  Again the _getURL method is retrieved, which 
> is unexpected as that value was replaced with the result of calling the 
> method in step #4 above.  'lazy_keys' no longer has the entry 'url', so the 
> method is not evaluated, and the method itself is returned.
> 
> Though the ActionInfo for this action is only created once, and the changes 
> made to it's 'lazy_keys' variable can be seen on subsequent calls to the 
> instance, it appears that some of the changes to the object are getting lost 
> between subsequent calls to __getitem__.  In fact, I tested setting a new 
> instance variable during the __getitem__ call, and on the subsequent call 
> this variable was no longer set!
> 
> If these were persistent objects I would attribute this sort of weirdness to 
> the need for some _p_changed updates or some partial transaction rollback, 
> but these are simple UserDict subclasses which are never stored in the ZODB.  
> I've thus far been unable to write a unit test which demonstrates the bug, 
> but it is easily repeatable.  Anybody have an idea what might be going on 
> here?
> 
> Alec
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at lists.zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests
> 



More information about the Zope-CMF mailing list