[Zope-dev] makerequest issues

Paul Winkler pw_lists at slinkp.com
Wed Apr 5 11:21:10 EDT 2006


On Wed, Apr 05, 2006 at 11:48:31AM +0200, Stefan H. Holek wrote:
> Regarding your patch, why do you use lambda: () and not lambda: ('',)?

Because that would change the path of the wrapped object,
which is not a desirable side effect.

Here's the behavior with my patch:

>>> from Testing.makerequest import makerequest
>>> from OFS.SimpleItem import SimpleItem
>>> item = SimpleItem(id='blah')
>>> # Wrapping an object with makerequest should not change its path.
>>> makerequest(app).getPhysicalPath() == app.getPhysicalPath()
True
>>> makerequest(item).getPhysicalPath() == item.getPhysicalPath()
True
>>> makerequest(item).getPhysicalPath()
('',)

Now here's the behavior with your suggestion:

>>> from Testing.makerequest import makerequest
>>> from OFS.SimpleItem import SimpleItem
>>> item = SimpleItem(id='blah')
>>> makerequest(app).getPhysicalPath() == app.getPhysicalPath()
True
>>> makerequest(item).getPhysicalPath() == item.getPhysicalPath()
False
>>> item.getPhysicalPath()
('',)
>>> makerequest(item).getPhysicalPath()   # uh-oh
('', '')

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope-Dev mailing list