Commit 5558216e authored by Julien Muchembled's avatar Julien Muchembled

Use default __hash__ method for ERP5 objects

If an object has no uid yet and has no acquisition context to the portal,
getUid() fails.

Default is derived from id(aq_base(ob)) which is even more efficient.

The method on XMLObject was also redundant because it inherited the same one
from Base.

(cherry picked from commit 347804af)
parent 9618a2c2
No related merge requests found
...@@ -2872,10 +2872,6 @@ class Base( CopyContainer, ...@@ -2872,10 +2872,6 @@ class Base( CopyContainer,
return dict(redirect_url=container.absolute_url(), return dict(redirect_url=container.absolute_url(),
selection_index=None, selection_name=None) selection_index=None, selection_name=None)
# Hash method
def __hash__(self):
return hash(self.getUid())
security.declareProtected(Permissions.ModifyPortalContent, 'setGuid') security.declareProtected(Permissions.ModifyPortalContent, 'setGuid')
def setGuid(self): def setGuid(self):
""" """
......
...@@ -108,9 +108,5 @@ class XMLObject( Folder ): ...@@ -108,9 +108,5 @@ class XMLObject( Folder ):
conduit = ERP5Conduit() conduit = ERP5Conduit()
conduit.addNode(object=self, xml=xml) conduit.addNode(object=self, xml=xml)
# Hash method
def __hash__(self):
return hash(self.getUid())
InitializeClass(XMLObject) InitializeClass(XMLObject)
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