Commit 2f48df3c authored by Yoshinori Okuji's avatar Yoshinori Okuji

Rename the parameter to importFiles from klass to item, because it is not a...

Rename the parameter to importFiles from klass to item, because it is not a class at all. Remove unused imports.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17059 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fa05aff3
...@@ -29,46 +29,25 @@ ...@@ -29,46 +29,25 @@
from Shared.DC.ZRDB.Connection import Connection as RDBConnection from Shared.DC.ZRDB.Connection import Connection as RDBConnection
from Globals import Persistent, PersistentMapping from Globals import Persistent, PersistentMapping
from Acquisition import Implicit, aq_base from Acquisition import Implicit, aq_base
from AccessControl.Permission import Permission
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet
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.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.RoleInformation import RoleInformation from Products.ERP5Type.RoleInformation import RoleInformation
import fnmatch import fnmatch
import re, os, sys, string, tarfile import re, os, string
from DateTime import DateTime
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
from OFS import XMLExportImport from OFS import XMLExportImport
from cStringIO import StringIO from cStringIO import StringIO
from copy import deepcopy from copy import deepcopy
from App.config import getConfiguration
from zExceptions import BadRequest from zExceptions import BadRequest
import OFS.XMLExportImport import OFS.XMLExportImport
customImporters={ customImporters={
XMLExportImport.magic: XMLExportImport.importXML, XMLExportImport.magic: XMLExportImport.importXML,
} }
from zLOG import LOG, WARNING, ERROR from zLOG import LOG, WARNING
from OFS.ObjectManager import customImporters from OFS.ObjectManager import customImporters
from gzip import GzipFile from gzip import GzipFile
from xml.dom.minidom import parse from xml.dom.minidom import parse
...@@ -256,11 +235,11 @@ class BusinessTemplateFolder(BusinessTemplateArchive): ...@@ -256,11 +235,11 @@ class BusinessTemplateFolder(BusinessTemplateArchive):
# to make id consistent, must remove a part of path while importing # 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(string.split(path, os.sep)) + 1
def importFiles(self, klass, **kw): def importFiles(self, item, **kw):
""" """
Import file from a local folder Import file from a local folder
""" """
class_name = klass.__class__.__name__ class_name = item.__class__.__name__
for file_path in self.file_list: for file_path in self.file_list:
if class_name in file_path.split(os.sep): if class_name in file_path.split(os.sep):
if os.path.isfile(file_path): if os.path.isfile(file_path):
...@@ -270,7 +249,7 @@ class BusinessTemplateFolder(BusinessTemplateArchive): ...@@ -270,7 +249,7 @@ class BusinessTemplateFolder(BusinessTemplateArchive):
file_name = string.join(folders[self.root_path_len:], '/') file_name = string.join(folders[self.root_path_len:], '/')
if '%' in file_name: if '%' in file_name:
file_name = unquote(file_name) file_name = unquote(file_name)
klass._importFile(file_name, file) item._importFile(file_name, file)
# close file # close file
file.close() file.close()
...@@ -323,11 +302,11 @@ class BusinessTemplateTarball(BusinessTemplateArchive): ...@@ -323,11 +302,11 @@ class BusinessTemplateTarball(BusinessTemplateArchive):
def _initImport(self, file=None, **kw): def _initImport(self, file=None, **kw):
self.f = file self.f = file
def importFiles(self, klass, **kw): def importFiles(self, item, **kw):
""" """
Import all file from the archive to the site Import all file from the archive to the site
""" """
class_name = klass.__class__.__name__ class_name = item.__class__.__name__
self.f.seek(0) self.f.seek(0)
data = GzipFile(fileobj=self.f).read() data = GzipFile(fileobj=self.f).read()
io = StringIO(data) io = StringIO(data)
...@@ -346,7 +325,7 @@ class BusinessTemplateTarball(BusinessTemplateArchive): ...@@ -346,7 +325,7 @@ class BusinessTemplateTarball(BusinessTemplateArchive):
file_name = ('/').join(folders[2:]) file_name = ('/').join(folders[2:])
if '%' in file_name: if '%' in file_name:
file_name = unquote(file_name) file_name = unquote(file_name)
klass._importFile(file_name, file) item._importFile(file_name, file)
file.close() file.close()
tar.close() tar.close()
io.close() io.close()
...@@ -441,7 +420,7 @@ class BaseTemplateItem(Implicit, Persistent): ...@@ -441,7 +420,7 @@ class BaseTemplateItem(Implicit, Persistent):
return self._objects.keys() return self._objects.keys()
def importFile(self, bta, **kw): def importFile(self, bta, **kw):
bta.importFiles(klass=self) bta.importFiles(item=self)
def removeProperties(self, obj): def removeProperties(self, obj):
""" """
......
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