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
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to