[Checkins] SVN: z3ext.ownership/tags/1.0.2/ egg 1.0.2
Nikolay Kim
fafhrd at datacom.kz
Thu May 22 06:31:10 EDT 2008
Log message for revision 86904:
egg 1.0.2
Changed:
A z3ext.ownership/tags/1.0.2/
U z3ext.ownership/tags/1.0.2/setup.py
D z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py
A z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py
-=-
Copied: z3ext.ownership/tags/1.0.2 (from rev 86901, z3ext.ownership/trunk)
Modified: z3ext.ownership/tags/1.0.2/setup.py
===================================================================
--- z3ext.ownership/trunk/setup.py 2008-05-21 22:49:29 UTC (rev 86901)
+++ z3ext.ownership/tags/1.0.2/setup.py 2008-05-22 10:31:09 UTC (rev 86904)
@@ -21,7 +21,7 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version='1.0.2dev'
+version='1.0.2'
setup(name = 'z3ext.ownership',
Deleted: z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py
===================================================================
--- z3ext.ownership/trunk/src/z3ext/ownership/owner.py 2008-05-21 22:49:29 UTC (rev 86901)
+++ z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py 2008-05-22 10:31:09 UTC (rev 86904)
@@ -1,95 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from rwproperty import getproperty, setproperty
-
-from zope import event, interface, component
-from zope.annotation.interfaces import IAnnotations
-from zope.lifecycleevent.interfaces import IObjectCreatedEvent
-
-from zope.security.proxy import removeSecurityProxy
-from zope.security.interfaces import IPrincipal, IGroup
-
-from z3ext.security.utils import getPrincipal
-
-from z3ext.ownership import interfaces
-from z3ext.ownership.interfaces import IInheritOwnership
-from z3ext.ownership.interfaces import IUnchangeableOwnership
-from z3ext.ownership.interfaces import OwnerChangedEvent
-
-ANNOTATION_KEY = 'z3ext.ownership.Owner'
-
-
-class Ownership(object):
- component.adapts(interfaces.IOwnerAware)
- interface.implements(interfaces.IOwnership)
-
- _ownerId = ''
- isGroup = False
-
- def __init__(self, context):
- annotations = IAnnotations(removeSecurityProxy(context))
-
- self.context = context
- self.annotations = annotations
-
- ownerinfo = annotations.get(ANNOTATION_KEY)
- if ownerinfo is None:
- ownerinfo = {'ownerId': None, 'isGroup': False}
- annotations[ANNOTATION_KEY] = ownerinfo
-
- self._ownerId = ownerinfo['ownerId']
- self.isGroup = ownerinfo['isGroup']
-
- @setproperty
- def owner(self, owner):
- if IPrincipal.providedBy(owner):
- oldOwner = self.owner
-
- self._ownerId = owner.id
- self.isGroup = IGroup.providedBy(owner)
-
- self.annotations[ANNOTATION_KEY] = {'ownerId': self._ownerId,
- 'isGroup': self.isGroup}
-
- event.notify(OwnerChangedEvent(self.context, owner, oldOwner))
- else:
- raise ValueError('IPrincipal object is required.')
-
- @getproperty
- def owner(self):
- if self._ownerId:
- return getPrincipal(self._ownerId)
- else:
- return None
-
- @getproperty
- def ownerId(self):
- return self._ownerId
-
- @setproperty
- def ownerId(self, pid):
- self.owner = getPrincipal(pid)
-
-
- at component.adapter(interfaces.IOwnerAware, IObjectCreatedEvent)
-def initObjectOwnership(object, event):
- if interfaces.IUnchangeableOwnership.providedBy(object) or \
- interfaces.IInheritOwnership.providedBy(object):
- return
-
- interfaces.IOwnership(removeSecurityProxy(object)).owner = getPrincipal()
Copied: z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py (from rev 86903, z3ext.ownership/trunk/src/z3ext/ownership/owner.py)
===================================================================
--- z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py (rev 0)
+++ z3ext.ownership/tags/1.0.2/src/z3ext/ownership/owner.py 2008-05-22 10:31:09 UTC (rev 86904)
@@ -0,0 +1,97 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from rwproperty import getproperty, setproperty
+
+from zope import event, interface, component
+from zope.annotation.interfaces import IAnnotations
+from zope.lifecycleevent.interfaces import IObjectCreatedEvent
+
+from zope.security.proxy import removeSecurityProxy
+from zope.security.interfaces import IPrincipal, IGroup
+
+from z3ext.security.utils import getPrincipal
+
+from z3ext.ownership import interfaces
+from z3ext.ownership.interfaces import IInheritOwnership
+from z3ext.ownership.interfaces import IUnchangeableOwnership
+from z3ext.ownership.interfaces import OwnerChangedEvent
+
+ANNOTATION_KEY = 'z3ext.ownership.Owner'
+
+
+class Ownership(object):
+ component.adapts(interfaces.IOwnerAware)
+ interface.implements(interfaces.IOwnership)
+
+ _ownerId = ''
+ isGroup = False
+
+ def __init__(self, context):
+ annotations = IAnnotations(removeSecurityProxy(context))
+
+ self.context = context
+ self.annotations = annotations
+
+ ownerinfo = annotations.get(ANNOTATION_KEY)
+ if ownerinfo is None:
+ ownerinfo = {'ownerId': None, 'isGroup': False}
+ annotations[ANNOTATION_KEY] = ownerinfo
+
+ self._ownerId = ownerinfo['ownerId']
+ self.isGroup = ownerinfo['isGroup']
+
+ @setproperty
+ def owner(self, owner):
+ if IPrincipal.providedBy(owner):
+ oldOwner = self.owner
+
+ self._ownerId = owner.id
+ self.isGroup = IGroup.providedBy(owner)
+
+ self.annotations[ANNOTATION_KEY] = {'ownerId': self._ownerId,
+ 'isGroup': self.isGroup}
+
+ event.notify(OwnerChangedEvent(self.context, owner, oldOwner))
+ else:
+ raise ValueError('IPrincipal object is required.')
+
+ @getproperty
+ def owner(self):
+ if self._ownerId:
+ return getPrincipal(self._ownerId)
+ else:
+ return None
+
+ @getproperty
+ def ownerId(self):
+ return self._ownerId
+
+ @setproperty
+ def ownerId(self, pid):
+ self.owner = getPrincipal(pid)
+
+
+ at component.adapter(interfaces.IOwnerAware, IObjectCreatedEvent)
+def initObjectOwnership(object, event):
+ if interfaces.IUnchangeableOwnership.providedBy(object) or \
+ interfaces.IInheritOwnership.providedBy(object):
+ return
+
+ principal = getPrincipal()
+ if principal is not None:
+ interfaces.IOwnership(removeSecurityProxy(object)).owner = principal
More information about the Checkins
mailing list