Hi,

We're using UUIDs a lot, and it's pretty painful that they are security
proxied. They're in the standard library from python 2.5
(http://docs.python.org/library/uuid.html) and are immutable according
to the documentation.

I think they meet all the all the requirements to be rocks. So unless
someone complains, I'll commit the attached patch in a few days.

-- 
Brian Sutherland
Index: CHANGES.txt
===================================================================
--- CHANGES.txt (revision 98805)
+++ CHANGES.txt (working copy)
@@ -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)
 ------------------
Index: src/zope/security/checker.py
===================================================================
--- src/zope/security/checker.py        (revision 98805)
+++ src/zope/security/checker.py        (working copy)
@@ -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(),
Index: src/zope/security/tests/test_standard_checkers.py
===================================================================
--- src/zope/security/tests/test_standard_checkers.py   (revision 98805)
+++ src/zope/security/tests/test_standard_checkers.py   (working copy)
@@ -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():
_______________________________________________
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