Commit 77def8a2 authored by Laurence Rowe's avatar Laurence Rowe

Implement getParentNode() in OFS.SimpleItem.Item as it is widely used.

parent 7a4c5942
......@@ -101,7 +101,7 @@ Restructuring
- 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`.
......
......@@ -26,6 +26,7 @@ import time
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 @@ class Item(Base,
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment