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

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Oct 20 20:57:16 CEST 2007


Author: yo
Date: Sat Oct 20 20:57:16 2007
New Revision: 17060

URL: http://svn.erp5.org?rev=17060&view=rev
Log:
Re-import symbols which are not detected by pyflakes automatically. Stop using string.

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

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=17060&r1=17059&r2=17060&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py Sat Oct 20 20:57:16 2007
@@ -32,11 +32,29 @@
 from AccessControl import ClassSecurityInfo
 from Products.CMFCore.utils import getToolByName
 from Products.ERP5Type.Base import WorkflowMethod
+from Products.ERP5Type.Utils import readLocalDocument, \
+                                    writeLocalDocument, \
+                                    importLocalDocument, \
+                                    removeLocalDocument
+from Products.ERP5Type.Utils import readLocalPropertySheet, \
+                                    writeLocalPropertySheet, \
+                                    importLocalPropertySheet, \
+                                    removeLocalPropertySheet
+from Products.ERP5Type.Utils import readLocalConstraint, \
+                                    writeLocalConstraint, \
+                                    importLocalConstraint, \
+                                    removeLocalConstraint
+from Products.ERP5Type.Utils import readLocalExtension, \
+                                    writeLocalExtension, \
+                                    removeLocalExtension
+from Products.ERP5Type.Utils import readLocalTest, \
+                                    writeLocalTest, \
+                                    removeLocalTest
 from Products.ERP5Type import Permissions, PropertySheet
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5Type.RoleInformation import RoleInformation
 import fnmatch
-import re, os, string
+import re, os
 from OFS.Traversable import NotFound
 from OFS import XMLExportImport
 from cStringIO import StringIO
@@ -233,7 +251,7 @@
     self.file_list = [os.path.normpath(f) for f in file]
     path = os.path.normpath(path)
     # to make id consistent, must remove a part of path while importing
-    self.root_path_len = len(string.split(path, os.sep)) + 1
+    self.root_path_len = len(path.split(os.sep)) + 1
 
   def importFiles(self, item, **kw):
     """
@@ -246,7 +264,7 @@
           file = open(file_path, 'rb')
           # get object id
           folders = file_path.split(os.sep)
-          file_name = string.join(folders[self.root_path_len:], '/')
+          file_name = os.path.join(*folders[self.root_path_len:])
           if '%' in file_name:
             file_name = unquote(file_name)
           item._importFile(file_name, file)
@@ -321,7 +339,7 @@
           file = tar.extractfile(info)
           tar_file_name = info.name.startswith('./') and info.name[2:] or \
               info.name
-          folders = string.split(tar_file_name, '/')
+          folders = tar_file_name.split('/')
           file_name = ('/').join(folders[2:])
           if '%' in file_name:
             file_name = unquote(file_name)
@@ -1686,7 +1704,6 @@
 
   def _importFile(self, file_name, file):
     path, name = posixpath.split(file_name)
-    id = string.split(name, '.')[0]
     xml = parse(file)
     portal_type_list = xml.getElementsByTagName('portal_type')
     for portal_type in portal_type_list:
@@ -2049,8 +2066,8 @@
       self._objects[file_name[:-4]] = obj
     else:
       # recreate data mapping specific to catalog method
-      path, name = posixpath.split(file_name)
-      id = string.split(name, '.')[0]
+      name = os.path.basename(file_name)
+      id = name.split('.', 1)[0]
       xml = parse(file)
       method_list = xml.getElementsByTagName('item')
       for method in method_list:
@@ -3639,7 +3656,7 @@
             action = update_dict[path]
             if action == 'nothing':
               continue
-          path = string.split(path, '/')
+          path = path.split('/')
           if len(path) == 2:
             lang = path[0]
             catalog = path[1]




More information about the Erp5-report mailing list