[Checkins] SVN: grok/trunk/src/grok/util.py Simplify code slighty by using zope.location.location.located(). Thanks to

Philipp von Weitershausen philikon at philikon.de
Fri Aug 31 05:04:11 EDT 2007


Log message for revision 79402:
  Simplify code slighty by using zope.location.location.located(). Thanks to
  Brendan Craig Rhodes for pointing this out.
  

Changed:
  U   grok/trunk/src/grok/util.py

-=-
Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py	2007-08-31 06:50:50 UTC (rev 79401)
+++ grok/trunk/src/grok/util.py	2007-08-31 09:04:10 UTC (rev 79402)
@@ -16,7 +16,7 @@
 
 import urllib
 
-import zope.location.interfaces
+import zope.location.location
 from zope import component
 from zope.traversing.browser.interfaces import IAbsoluteURL
 from zope.traversing.browser.absoluteurl import _safe as SAFE_URL_CHARACTERS
@@ -95,7 +95,5 @@
     """
     if getattr(obj, '__parent__', None) is not None:
         return obj
-    if zope.location.interfaces.ILocation.providedBy(obj):
-        zope.location.locate(obj, parent, name)
-        return obj
-    return zope.location.LocationProxy(obj, parent, name)
+    # This either sets __parent__ or wraps 'obj' in a LocationProxy
+    return zope.location.location.located(obj, parent, name)



More information about the Checkins mailing list