[Checkins] SVN: zope.security/trunk/ Make UUIDs rocks, as (not) discussed on zope-dev http://mail.zope.org/pipermail/zope-dev/2009-April/035724.html

Brian Sutherland jinty at web.de
Fri Apr 10 05:35:07 EDT 2009


Log message for revision 99070:
  Make UUIDs rocks, as (not) discussed on zope-dev http://mail.zope.org/pipermail/zope-dev/2009-April/035724.html

Changed:
  U   zope.security/trunk/CHANGES.txt
  U   zope.security/trunk/src/zope/security/checker.py
  U   zope.security/trunk/src/zope/security/tests/test_standard_checkers.py

-=-
Modified: zope.security/trunk/CHANGES.txt
===================================================================
--- zope.security/trunk/CHANGES.txt	2009-04-10 01:02:24 UTC (rev 99069)
+++ zope.security/trunk/CHANGES.txt	2009-04-10 09:35:06 UTC (rev 99070)
@@ -5,7 +5,8 @@
 3.6.4 (unreleased)
 ------------------
 
-- None so far.
+- Make uuid.UUID a rock, they are immutable and in the python standad library
+  from python 2.5.
 
 3.6.3 (2009-03-23)
 ------------------

Modified: zope.security/trunk/src/zope/security/checker.py
===================================================================
--- zope.security/trunk/src/zope/security/checker.py	2009-04-10 01:02:24 UTC (rev 99069)
+++ zope.security/trunk/src/zope/security/checker.py	2009-04-10 09:35:06 UTC (rev 99070)
@@ -624,6 +624,13 @@
     type(pytz.UTC): NoProxy,
 })
 
+try:
+    # NOTE: remove try/except when we depend on python2.5 and up. uuid in standard library from python 2.5.
+    from uuid import UUID
+    BasicTypes[UUID] = NoProxy
+except ImportError:
+    pass
+
 # Available for tests. Located here so it can be kept in sync with BasicTypes.
 BasicTypes_examples = {
     object: object(),

Modified: zope.security/trunk/src/zope/security/tests/test_standard_checkers.py
===================================================================
--- zope.security/trunk/src/zope/security/tests/test_standard_checkers.py	2009-04-10 01:02:24 UTC (rev 99069)
+++ zope.security/trunk/src/zope/security/tests/test_standard_checkers.py	2009-04-10 09:35:06 UTC (rev 99070)
@@ -424,6 +424,14 @@
     >>> from pytz import UTC
     >>> int(type(ProxyFactory(  UTC )) is type(UTC))
     1
+    
+    >>> try:
+    ...     # NOTE: remove try/except when we depend on python 2.5 and greater (uuid in standard library)
+    ...     from uuid import UUID
+    ...     int(type(ProxyFactory(  UUID('12345678123456781234567812345678') )) is UUID)
+    ... except ImportError:
+    ...     1
+    1
     """
 
 def test_iter_of_sequences():



More information about the Checkins mailing list