[Checkins] SVN: Zope/trunk/ Implement getParentNode() in OFS.SimpleItem.Item as it is widely used.

Lawrence Rowe cvs-admin at zope.org
Fri Aug 31 11:03:41 UTC 2012


Log message for revision 127657:
  Implement getParentNode() in OFS.SimpleItem.Item as it is widely used.

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/OFS/SimpleItem.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2012-08-31 06:24:35 UTC (rev 127656)
+++ Zope/trunk/doc/CHANGES.rst	2012-08-31 11:03:37 UTC (rev 127657)
@@ -101,7 +101,7 @@
 - Removed `mime-types` option from `zope.conf`. You can use the `add_files`
   API from `zope.contenttype` instead.
 
-- Removed `OFS.ZDOM`.
+- Removed `OFS.ZDOM`. `OFS.SimpleItem.Item` now implements `getParentNode()`.
 
 - Removed the last remaining code to support `SOFTWARE_HOME` and `ZOPE_HOME`.
 

Modified: Zope/trunk/src/OFS/SimpleItem.py
===================================================================
--- Zope/trunk/src/OFS/SimpleItem.py	2012-08-31 06:24:35 UTC (rev 127656)
+++ Zope/trunk/src/OFS/SimpleItem.py	2012-08-31 11:03:37 UTC (rev 127657)
@@ -26,6 +26,7 @@
 from AccessControl.class_init import InitializeClass
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from AccessControl.SecurityManagement import getSecurityManager
+from AccessControl.Permissions import access_contents_information
 from AccessControl.Permissions import view as View
 from AccessControl.unauthorized import Unauthorized
 from AccessControl.ZopeSecurityPolicy import getRoles
@@ -369,6 +370,12 @@
         res += '>'
         return res
 
+    security.declareProtected(access_contents_information, 'getParentNode')
+    def getParentNode(self):
+        """The parent of this node.  All nodes except Document
+        DocumentFragment and Attr may have a parent"""
+        return getattr(self, '__parent__', None)
+
 InitializeClass(Item)
 
 



More information about the checkins mailing list