[Erp5-report] r14247 - /erp5/trunk/products/ERP5/Document/Document.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 26 18:39:46 CEST 2007


Author: ivan
Date: Thu Apr 26 18:39:41 2007
New Revision: 14247

URL: http://svn.erp5.org?rev=14247&view=rev
Log:
Import order. Use contants where applicable. Fix workflow state used in portal_catalog query.

Modified:
    erp5/trunk/products/ERP5/Document/Document.py

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=14247&r1=14246&r2=14247&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py (original)
+++ erp5/trunk/products/ERP5/Document/Document.py Thu Apr 26 18:39:41 2007
@@ -26,17 +26,15 @@
 #
 ##############################################################################
 
+import re, socket
 from DateTime import DateTime
 from operator import add
 from xmlrpclib import Fault
-import re
-import socket
-
+from zLOG import LOG, INFO
 from AccessControl import ClassSecurityInfo, getSecurityManager
 from Acquisition import aq_base
 from Globals import PersistentMapping
-from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.utils import _checkPermission
+from Products.CMFCore.utils import getToolByName, _checkPermission
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5Type.WebDAVSupport import TextContent
@@ -45,10 +43,10 @@
 from Products.ERP5.Document.Url import UrlMixIn
 from Products.ERP5.Tool.ContributionTool import MAX_REPEAT
 
-from zLOG import LOG, INFO
-
 _MARKER = []
 VALID_ORDER_KEY_LIST = ('user_login', 'content', 'file_name', 'input')
+# these property ids are unchangable
+FIXED_PROPERTY_IDS =  ('id', 'uid', 'rid', 'sid') 
 
 def makeSortedTuple(kw):
   items = kw.items()
@@ -710,15 +708,13 @@
                                             version=self.getVersion(),
                                             language=self.getLanguage(),
                                             uid=self.getUid(),
-                validation_state="!=deleted" # XXX Either use a system pref
-                                              # or implement a class method
+                                            validation_state="!=cancelled"
                                             )[0][0]
     count = catalog.unrestrictedCountResults(portal_type=self.getPortalDocumentTypeList(),
                                             reference=self.getReference(),
                                             version=self.getVersion(),
                                             language=self.getLanguage(),
-                validation_state="<> deleted" # XXX Either use a system pref
-                                              # or implement a class method
+                                            validation_state="<> cancelled"
                                             )[0][0]
     # If self is not indexed yet, then if count == 1, version is not unique
     return count <= self_count
@@ -801,9 +797,7 @@
       # Find all document with same (reference, version, language)
       kw = dict(portal_type=self.getPortalDocumentTypeList(),
                 reference=self.getReference(),
-                validation_state="!=cancelled") # XXX Either use a system pref
-                                               # or implement a class method
-                                               # because !=delete is hardcoded
+                validation_state="!=cancelled")
       if self.getVersion(): kw['version'] = self.getVersion()
       if self.getLanguage(): kw['language'] = self.getLanguage()
       document_list = catalog.unrestrictedSearchResults(**kw)
@@ -830,7 +824,7 @@
         else:
           update_kw = {}
           for k in self.propertyIds():
-            if k not in ('id', 'uid', 'rid', 'sid') and self.hasProperty(k): # XXX Use a global list instead
+            if k not in FIXED_PROPERTY_IDS and self.hasProperty(k):
               update_kw[k] = self.getProperty(k)
           existing_document.edit(**update_kw)
           # Erase self




More information about the Erp5-report mailing list