[Checkins] SVN: zope.location/trunk/ Prep for Py3k compatibility.

Tres Seaver cvs-admin at zope.org
Thu Jun 7 01:32:31 UTC 2012


Log message for revision 126652:
  Prep for Py3k compatibility.
  
  Can't finish until zope.component is ready.

Changed:
  _U  zope.location/trunk/
  A   zope.location/trunk/src/zope/location/_compat.py
  U   zope.location/trunk/src/zope/location/interfaces.py
  U   zope.location/trunk/tox.ini

-=-
Added: zope.location/trunk/src/zope/location/_compat.py
===================================================================
--- zope.location/trunk/src/zope/location/_compat.py	                        (rev 0)
+++ zope.location/trunk/src/zope/location/_compat.py	2012-06-07 01:32:28 UTC (rev 126652)
@@ -0,0 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2003-2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import sys
+
+PY3 = sys.version_info[0] >= 3
+
+if PY3: #pragma NO COVER
+    def u(s):
+        return s
+else: #pragma NO COVER
+    def u(s):
+        return unicode(s, "unicode_escape")

Modified: zope.location/trunk/src/zope/location/interfaces.py
===================================================================
--- zope.location/trunk/src/zope/location/interfaces.py	2012-06-07 01:32:24 UTC (rev 126651)
+++ zope.location/trunk/src/zope/location/interfaces.py	2012-06-07 01:32:28 UTC (rev 126652)
@@ -15,14 +15,17 @@
 """
 __docformat__ = 'restructuredtext'
 
-import zope.interface
-import zope.schema
+from zope.interface import Interface
+from zope.interface import Attribute
+from zope.schema import TextLine
 
 # BBB
-from zope.component.interfaces import IPossibleSite, ISite
+from zope.component.interfaces import IPossibleSite
+from zope.component.interfaces import ISite
 
+from zope.location._compat import u
 
-class ILocation(zope.interface.Interface):
+class ILocation(Interface):
     """Objects that can be located in a hierachy.
 
     Given a parent and a name an object can be located within that parent. The
@@ -40,12 +43,12 @@
 
     """
 
-    __parent__ = zope.interface.Attribute("The parent in the location hierarchy.")
+    __parent__ = Attribute("The parent in the location hierarchy.")
 
-    __name__ = zope.schema.TextLine(
-        title=u"The name within the parent",
-        description=u"The object can be looked up from the parent's "
-            "sublocations using this name.",
+    __name__ = TextLine(
+        title=u("The name within the parent"),
+        description=u("The object can be looked up from the parent's "
+            "sublocations using this name."),
         required=False,
         default=None)
 
@@ -57,7 +60,7 @@
 class IContained(ILocation):
     """Objects contained in containers."""
 
-class ILocationInfo(zope.interface.Interface):
+class ILocationInfo(Interface):
     """Provides supplemental information for located objects.
 
     Requires that the object has been given a location in a hierarchy.
@@ -103,7 +106,7 @@
         """
 
 
-class ISublocations(zope.interface.Interface):
+class ISublocations(Interface):
     """Provide access to sublocations of an object.
 
     All objects with the same parent object are called the ``sublocations`` of
@@ -115,7 +118,7 @@
         """Return an iterable of the object's sublocations."""
 
 
-class IRoot(zope.interface.Interface):
+class IRoot(Interface):
     """Marker interface to designate root objects within a location hierarchy.
     """
 

Modified: zope.location/trunk/tox.ini
===================================================================
--- zope.location/trunk/tox.ini	2012-06-07 01:32:24 UTC (rev 126651)
+++ zope.location/trunk/tox.ini	2012-06-07 01:32:28 UTC (rev 126652)
@@ -3,7 +3,9 @@
 # Jython support pending 2.7 support, due 2012-07-15 or so.  See:
 # http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
 #   py26,py27,py32,jython,pypy,coverage
-    py26,py27,py32,pypy,coverage,docs
+# py32 support pending zope.component
+#   py26,py27,py32,pypy,coverage,docs
+    py26,py27,pypy,coverage,docs
 
 [testenv]
 commands = 



More information about the checkins mailing list