From 347804af6ed8e114c6195cca128afea946240043 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Wed, 7 May 2014 18:21:29 +0200 Subject: [PATCH] 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. --- product/ERP5Type/Base.py | 4 ---- product/ERP5Type/XMLObject.py | 4 ---- 2 files changed, 8 deletions(-) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index 4d0674451b..c6ca04cc78 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -2876,10 +2876,6 @@ class Base( CopyContainer, return dict(redirect_url=container.absolute_url(), selection_index=None, selection_name=None) - # Hash method - def __hash__(self): - return hash(self.getUid()) - security.declareProtected(Permissions.ModifyPortalContent, 'setGuid') def setGuid(self): """ diff --git a/product/ERP5Type/XMLObject.py b/product/ERP5Type/XMLObject.py index b9faaddf95..2cc5781ad5 100644 --- a/product/ERP5Type/XMLObject.py +++ b/product/ERP5Type/XMLObject.py @@ -108,9 +108,5 @@ class XMLObject( Folder ): conduit = ERP5Conduit() conduit.addNode(object=self, xml=xml) - # Hash method - def __hash__(self): - return hash(self.getUid()) - InitializeClass(XMLObject) -- 2.30.9