Commit 8670f40a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

define __getitem__ instead of _getOb in class tool so that it works on Zope-2.12.23 too.

parent d1a41392
...@@ -224,7 +224,7 @@ if allowClassTool(): ...@@ -224,7 +224,7 @@ if allowClassTool():
self.__importer(class_id) self.__importer(class_id)
self.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() self.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary()
def _getOb(self, key, default=_MARKER ): def __getitem__(self, key, default=_MARKER ):
if key in self.objectIds(): if key in self.objectIds():
return FileProxy(self, key).__of__(self) return FileProxy(self, key).__of__(self)
# maybe the file has just been uploaded, and is still in the temporary # maybe the file has just been uploaded, and is still in the temporary
...@@ -240,7 +240,7 @@ if allowClassTool(): ...@@ -240,7 +240,7 @@ if allowClassTool():
# be read yet, because the transaction is not commited. # be read yet, because the transaction is not commited.
self._v_created = {name: True} self._v_created = {name: True}
self.write(name, body, create=True) self.write(name, body, create=True)
return self._getOb(name) return self.__getitem__(name)
def _verifyObjectPaste(self, ob, validate_src=True): def _verifyObjectPaste(self, ob, validate_src=True):
# we only allow FileProxy (this is used in PUT) # we only allow FileProxy (this is used in PUT)
...@@ -262,12 +262,12 @@ if allowClassTool(): ...@@ -262,12 +262,12 @@ if allowClassTool():
security = ClassSecurityInfo() security = ClassSecurityInfo()
# we set _folder_handler to OFS_HANDLER to have default behaviour of # we set _folder_handler to OFS_HANDLER to have default behaviour of
# using objectIds and _getOb # using objectIds and __getitem__
_folder_handler = OFS_HANDLER _folder_handler = OFS_HANDLER
def objectIds(self, spec=None): def objectIds(self, spec=None):
return ('PropertySheet', 'Document', 'Constraint', 'Extensions', 'tests') return ('PropertySheet', 'Document', 'Constraint', 'Extensions', 'tests')
def _getOb(self, key, default=_MARKER): def __getitem__(self, key, default=_MARKER):
from Products.ERP5Type.Utils import importLocalPropertySheet from Products.ERP5Type.Utils import importLocalPropertySheet
from Products.ERP5Type.Utils import importLocalDocument from Products.ERP5Type.Utils import importLocalDocument
from Products.ERP5Type.Utils import importLocalConstraint from Products.ERP5Type.Utils import importLocalConstraint
......
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