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

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 3 11:29:29 CEST 2009


Author: kazuhiko
Date: Thu Sep  3 11:29:27 2009
New Revision: 28773

URL: http://svn.erp5.org?rev=28773&view=rev
Log:
only fixing typos and cosmetic changes.

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=28773&r1=28772&r2=28773&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Thu Sep  3 11:29:27 2009
@@ -1,14 +1,14 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
-# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
+# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
 #                    Jean-Paul Smets-Solanes <jp at nexedi.com>
 #
 # WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
+# programmers who take the whole responsibility of assessing all potential
 # consequences resulting from its eventual inadequacies and bugs
 # End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
+# guarantees and support are strongly adviced to contract a Free Software
 # Service Company
 #
 # This program is Free Software; you can redistribute it and/or
@@ -59,7 +59,7 @@
 _MARKER = []
 VALID_ORDER_KEY_LIST = ('user_login', 'content', 'file_name', 'input')
 # these property ids are unchangable
-FIXED_PROPERTY_IDS =  ('id', 'uid', 'rid', 'sid') 
+FIXED_PROPERTY_IDS =  ('id', 'uid', 'rid', 'sid')
 
 def makeSortedTuple(kw):
   items = kw.items()
@@ -231,7 +231,7 @@
     """Generate proper cache id based on **kw.
     Function inspired from ERP5Type.Cache
     """
-    return str(makeSortedTuple(kw)).translate(string.maketrans('', ''), """[]()<>'", """)
+    return str(makeSortedTuple(kw)).translate(string.maketrans('', ''), '[]()<>\'", ')
 
 class PermanentURLMixIn(ExtensibleTraversableMixIn):
   """
@@ -354,7 +354,7 @@
         pass
 
     if method is None:
-      method = self._getTypeBasedMethod('getDocumentValue', 
+      method = self._getTypeBasedMethod('getDocumentValue',
               fallback_script_id='WebSection_getDocumentValue')
 
     if cache is not None:
@@ -417,7 +417,7 @@
   security.declareProtected(Permissions.AccessContentsInformation, 'getCreationDateIndex')
   def getCreationDateIndex(self, at_date = None):
     """
-    Returns the document Creation Date Index which is the creation 
+    Returns the document Creation Date Index which is the creation
     date converted into hours modulo the Frequency Index.
     """
     frequency_index = self.getFrequencyIndex()
@@ -440,7 +440,7 @@
       workflow states (publication state,
       validation state) or on roles on the document.
     """
-    method = self._getTypeBasedMethod('isUpdatable', 
+    method = self._getTypeBasedMethod('isUpdatable',
         fallback_script_id = 'Document_isUpdatable')
     return method()
 
@@ -605,19 +605,19 @@
       The implementation goes in 2 steps:
 
     - Step 1: extract with a regular expression
-      a list of distionaries with various parameters such as 
+      a list of distionaries with various parameters such as
       reference, portal_type, language, version, user, etc. This
       part is configured through a portal preference.
 
     - Step 2: read the list of dictionaries
       and build a list of values by calling portal_catalog
-      with appropriate parameters (and if possible build 
+      with appropriate parameters (and if possible build
       a complex query whenever this becomes available in
       portal catalog)
-      
+
       The script is reponsible for calling getSearchableReferenceList
       so that it can use another approach if needed.
-      
+
       NOTE: passing a group_by parameter may be useful at a
       later stage of the implementation.
     """
@@ -637,7 +637,7 @@
   def getImplicitPredecessorValueList(self):
     """
       This function tries to find document which are referencing us - by reference only, or
-      by reference/language etc. Implementation is passed to 
+      by reference/language etc. Implementation is passed to
         Base_getImplicitPredecessorValueList
 
       The script should proceed in two steps:
@@ -647,7 +647,7 @@
 
       Step 2: search using the portal_catalog and use
       priorities (ex. INV-123456 before 123456)
-      ( if possible build  a complex query whenever 
+      ( if possible build  a complex query whenever
       this becomes available in portal catalog )
 
       NOTE: passing a group_by parameter may be useful at a
@@ -660,7 +660,7 @@
     except KeyError:
       pass
 
-    method = self._getTypeBasedMethod('getImplicitPredecessorValueList', 
+    method = self._getTypeBasedMethod('getImplicitPredecessorValueList',
         fallback_script_id = 'Base_getImplicitPredecessorValueList')
     result = method()
     tv[cache_key] = result
@@ -680,7 +680,7 @@
   def getSimilarCloudValueList(self, depth=0):
     """
       Returns all documents which are similar to us, directly or indirectly, and
-      in both directions. In other words, it is a transitive closure of similar 
+      in both directions. In other words, it is a transitive closure of similar
       relation. Every document is returned in the latest version available.
     """
     lista = {}
@@ -705,11 +705,11 @@
     lista_latest = {}
     for o in lista.keys():
       lista_latest[o.getLatestVersionValue()] = True # get latest versions avoiding duplicates again
-    if lista_latest.has_key(self): 
+    if lista_latest.has_key(self):
       lista_latest.pop(self) # remove this document
     if lista_latest.has_key(self.getLatestVersionValue()):
       # remove last version of document itself from related documents
-      lista_latest.pop(self.getLatestVersionValue()) 
+      lista_latest.pop(self.getLatestVersionValue())
 
     return lista_latest.keys()
 
@@ -916,7 +916,7 @@
     # XXX - cache or set?
     reference = self.getReference()
     if not reference:
-      return 
+      return
     catalog = getToolByName(self, 'portal_catalog', None)
     res = catalog(reference=self.getReference(), sort_on=(('creation_date','ascending'),))
     # XXX this should be security-unaware - delegate to script with proxy roles
@@ -989,7 +989,7 @@
     Returns the document coordinates as a standard file name. This
     method is the reverse of getPropertyDictFromFileName.
     """
-    method = self._getTypeBasedMethod('getStandardFileName', 
+    method = self._getTypeBasedMethod('getStandardFileName',
         fallback_script_id = 'Document_getStandardFileName')
     return method()
 
@@ -1009,7 +1009,7 @@
                    currently logged in, then we'll get him from session
     """
     # Preference is made of a sequence of 'user_login', 'content', 'file_name', 'input'
-    method = self._getTypeBasedMethod('getPreferredDocumentMetadataDiscoveryOrderList', 
+    method = self._getTypeBasedMethod('getPreferredDocumentMetadataDiscoveryOrderList',
         fallback_script_id = 'Document_getPreferredDocumentMetadataDiscoveryOrderList')
     order_list = list(method())
     order_list.reverse()
@@ -1189,14 +1189,14 @@
     else:
       stripped_html = html
     # find charset and convert to utf-8
-    charset_list = self.charset_parser.findall(str(html)) # XXX - Not efficient if this 
+    charset_list = self.charset_parser.findall(str(html)) # XXX - Not efficient if this
                                          # is datastream instance but hard to do better
     if charset and not charset_list:
       # Use optional parameter is we can not find encoding in HTML
       charset_list = [charset]
     if charset_list and charset_list[0] not in ('utf-8', 'UTF-8'):
       try:
-        stripped_html = unicode(str(stripped_html), 
+        stripped_html = unicode(str(stripped_html),
                                 charset_list[0]).encode('utf-8')
       except (UnicodeDecodeError, LookupError):
         return str(stripped_html)
@@ -1279,7 +1279,7 @@
       method = self._getTypeBasedMethod('getMetadataMappingDict')
     except KeyError, AttributeError:
       method = None
-    if method is not None: 
+    if method is not None:
       return method()
     else:
       return {}
@@ -1352,7 +1352,7 @@
       Ask container if we are and index, or a content.
       In the vast majority of cases we are content.
       This method is required in a crawling process to make
-      a difference between URLs which return an index (ex. the 
+      a difference between URLs which return an index (ex. the
       list of files in remote server which is accessed through HTTP)
       and the files themselves.
     """




More information about the Erp5-report mailing list