[Checkins] SVN: zope.introspectorui/trunk/src/zope/introspectorui/code.py Support for Zope 2.
Lennart Regebro
regebro at gmail.com
Wed Aug 13 05:05:10 EDT 2008
Log message for revision 89788:
Support for Zope 2.
Changed:
U zope.introspectorui/trunk/src/zope/introspectorui/code.py
-=-
Modified: zope.introspectorui/trunk/src/zope/introspectorui/code.py
===================================================================
--- zope.introspectorui/trunk/src/zope/introspectorui/code.py 2008-08-13 08:26:04 UTC (rev 89787)
+++ zope.introspectorui/trunk/src/zope/introspectorui/code.py 2008-08-13 09:05:10 UTC (rev 89788)
@@ -14,7 +14,24 @@
"""Views for code-related infos.
"""
import grokcore.view as grok
-from zope.location.location import located
+try:
+ from zope.location.location import located
+except ImportError:
+ # Zope 2.10 compatibility:
+ from zope.location.interfaces import ILocation
+ from zope.location.location import LocationProxy, locate
+ def located(object, parent, name=None):
+ """Locate an object in another and return it.
+
+ If the object does not provide ILocation a LocationProxy is returned.
+
+ """
+ if ILocation.providedBy(object):
+ if parent is not object.__parent__ or name != object.__name__:
+ locate(object, parent, name)
+ return object
+ return LocationProxy(object, parent, name)
+
from zope.introspector.code import PackageInfo, FileInfo, ModuleInfo
from zope.introspectorui.interfaces import IBreadcrumbProvider, ICodeView
More information about the Checkins
mailing list