[Zope3-dev] More patches

Gustavo Niemeyer niemeyer at conectiva.com
Tue Sep 21 14:59:01 EDT 2004


> Hello folks,
> 
> Here's a minor patch created while reading code.

And here are three other small patches:

zope3-securitymap.patch
- Small but important fix to security map. It's currently not
  marking objects with modified permissions as changed, due to
  a missing assignment.

zope3-owner.patch
- Patch implementing a suggested "Owner" role.

zope3-doc.patch
- More typo fixes.

-- 
Gustavo Niemeyer
http://niemeyer.net
-------------- next part --------------
Index: src/persistent/mapping.py
===================================================================
--- src/persistent/mapping.py	(revision 27642)
+++ src/persistent/mapping.py	(working copy)
@@ -83,7 +83,7 @@
 
     # Effectively, the original rep is part of the "API."  To provide
     # full compatibility, the getstate and setstate must read and
-    # right objects using the old rep.
+    # write objects using the old rep.
 
     # As a result, the PersistentMapping must save and restore the
     # actual internal dictionary using the name _container.
Index: src/zope/app/securitypolicy/principalrole.py
===================================================================
--- src/zope/app/securitypolicy/principalrole.py	(revision 27642)
+++ src/zope/app/securitypolicy/principalrole.py	(working copy)
@@ -79,7 +79,7 @@
         ''' See the interface IPrincipalRoleManager '''
 
         # Don't check validity intentionally.
-        # After all, we certianly want to unset invalid ids.
+        # After all, we certainly want to unset invalid ids.
 
         self.delCell(role_id, principal_id)
 
Index: src/zope/app/catalog/README.txt
===================================================================
--- src/zope/app/catalog/README.txt	(revision 27642)
+++ src/zope/app/catalog/README.txt	(working copy)
@@ -356,7 +356,7 @@
 
 
 Now that we have a catalog with some documents indexed, we can search
-it.  The catalog is really meany yo be used from Python:
+it.  The catalog is really meant to be used from Python:
 
   >>> root = getRootFolder()
 
-------------- next part --------------
Index: src/zope/app/securitypolicy/zopepolicy.py
===================================================================
--- src/zope/app/securitypolicy/zopepolicy.py	(revision 27642)
+++ src/zope/app/securitypolicy/zopepolicy.py	(working copy)
@@ -24,6 +24,8 @@
 from zope.security.interfaces import ISecurityPolicy
 from zope.security.proxy import removeSecurityProxy
 
+from zope.app.dublincore.interfaces import IZopeDublinCore
+
 from zope.app.security.settings import Allow, Deny
 
 from zope.app.securitypolicy.principalpermission \
@@ -189,7 +191,7 @@
             cache_principal_roles[principal] = roles
             return roles
             
-        roles = self.cached_principal_roles(
+        parentroles = roles = self.cached_principal_roles(
             removeSecurityProxy(getattr(parent, '__parent__', None)),
             principal)
         prinrole = IPrincipalRoleMap(parent, None)
@@ -200,6 +202,11 @@
                     roles[role] = 1
                 elif role in roles:
                     del roles[role]
+        dc = IZopeDublinCore(parent, None)
+        if dc and principal in dc.creators:
+            if roles is parentroles:
+                roles = roles.copy()
+            roles["zope.Owner"] = 1
 
         cache_principal_roles[principal] = roles
         return roles
Index: src/zope/app/securitypolicy/configure.zcml
===================================================================
--- src/zope/app/securitypolicy/configure.zcml	(revision 27642)
+++ src/zope/app/securitypolicy/configure.zcml	(working copy)
@@ -92,6 +92,8 @@
                  description="All users have this role implicitly" />
   <role id="zope.Manager" title="Site Manager" />
   <role id="zope.Member" title="Site Member" />
+  <role id="zope.Owner" title="Object Owner"
+                 description="Object owners" />
 
   <!-- Replace the following directive if you don't want public access -->
   <grant permission="zope.View"                  
-------------- next part --------------
Index: src/zope/app/securitypolicy/securitymap.py
===================================================================
--- src/zope/app/securitypolicy/securitymap.py	(revision 27642)
+++ src/zope/app/securitypolicy/securitymap.py	(working copy)
@@ -143,7 +143,7 @@
     def _changed(self):
         map = self.map
         if isinstance(map, PersistentSecurityMap):
-            map._p_changed
+            map._p_changed = 1
         else:
             map = PersistentSecurityMap()
             map._byrow = self._byrow


More information about the Zope3-dev mailing list