Commit efaee02a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

remove deprecation warnings.

parent aa4c5121
...@@ -3,7 +3,6 @@ import re ...@@ -3,7 +3,6 @@ import re
import os import os
import sys import sys
import csv import csv
from Products.CMFCore.utils import expandpath
from zLOG import LOG from zLOG import LOG
from App.config import getConfiguration from App.config import getConfiguration
...@@ -228,7 +227,7 @@ def fixSkinNames(self, REQUEST=None, file=None, dry_run=0): ...@@ -228,7 +227,7 @@ def fixSkinNames(self, REQUEST=None, file=None, dry_run=0):
msg += '%s\n' % line msg += '%s\n' % line
if not dry_run: if not dry_run:
if skin.meta_type in fs_skin_spec: if skin.meta_type in fs_skin_spec:
with open(expandpath(skin.getObjectFSPath()), 'w') as f: with open(skin.getObjectFSPath(), 'w') as f:
f.write(text) f.write(text)
else: else:
REQUEST['BODY'] = text REQUEST['BODY'] = text
...@@ -359,7 +358,7 @@ def fixSkinNames(self, REQUEST=None, file=None, dry_run=0): ...@@ -359,7 +358,7 @@ def fixSkinNames(self, REQUEST=None, file=None, dry_run=0):
try: try:
if info.meta_type in fs_skin_spec: if info.meta_type in fs_skin_spec:
skin = self.portal_skins[info.folder][info.name] skin = self.portal_skins[info.folder][info.name]
old_path = expandpath(skin.getObjectFSPath()) old_path = skin.getObjectFSPath()
new_path = info.regexp.sub(info.new_name, old_path) new_path = info.regexp.sub(info.new_name, old_path)
if info.removed: if info.removed:
os.remove(old_path) os.remove(old_path)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import PersistentMapping from Persistence import PersistentMapping
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
......
...@@ -5,7 +5,6 @@ from Products.CMFCore.permissions import View, ViewManagementScreens ...@@ -5,7 +5,6 @@ from Products.CMFCore.permissions import View, ViewManagementScreens
from Products.CMFCore.FSObject import FSObject from Products.CMFCore.FSObject import FSObject
from Products.CMFCore.DirectoryView import registerFileExtension,\ from Products.CMFCore.DirectoryView import registerFileExtension,\
registerMetaType registerMetaType
from Products.CMFCore.utils import expandpath
from Products.ERP5Form import _dtmldir from Products.ERP5Form import _dtmldir
from Products.ERP5Form.Form import ERP5Form from Products.ERP5Form.Form import ERP5Form
...@@ -39,7 +38,7 @@ class ERP5FSForm(FSObject, ERP5Form): ...@@ -39,7 +38,7 @@ class ERP5FSForm(FSObject, ERP5Form):
return obj return obj
def _readFile(self, reparse): def _readFile(self, reparse):
f = open(expandpath(self._filepath), 'rb') f = open(self._filepath, 'rb')
# update the form with the xml data # update the form with the xml data
try: try:
XMLToForm(f.read(), self) XMLToForm(f.read(), self)
...@@ -49,7 +48,7 @@ class ERP5FSForm(FSObject, ERP5Form): ...@@ -49,7 +48,7 @@ class ERP5FSForm(FSObject, ERP5Form):
# (except if the LOG raises another one ... should we be more paranoid here?) # (except if the LOG raises another one ... should we be more paranoid here?)
import zLOG import zLOG
zLOG.LOG('Formulator.FSForm',zLOG.ERROR, zLOG.LOG('Formulator.FSForm',zLOG.ERROR,
'error reading form from file '+expandpath(self._filepath)) 'error reading form from file '+self._filepath)
raise raise
f.close() f.close()
......
...@@ -38,7 +38,7 @@ from Products.CMFCore.exceptions import AccessControl_Unauthorized ...@@ -38,7 +38,7 @@ from Products.CMFCore.exceptions import AccessControl_Unauthorized
from Acquisition import Implicit, aq_base from Acquisition import Implicit, aq_base
from Products.ERP5Type.Globals import InitializeClass, DTMLFile, Persistent from Products.ERP5Type.Globals import InitializeClass, DTMLFile, Persistent
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.Role import RoleManager from OFS.role import RoleManager
from OFS.SimpleItem import Item from OFS.SimpleItem import Item
from OFS.PropertyManager import PropertyManager from OFS.PropertyManager import PropertyManager
from urllib import quote, quote_plus from urllib import quote, quote_plus
......
...@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo ...@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Permissions import ManagePortal from Products.ERP5Type.Permissions import ManagePortal
from Globals import DTMLFile from Products.ERP5Type.Globals import DTMLFile
from Products.ERP5SecurePayment import _dtmldir from Products.ERP5SecurePayment import _dtmldir
from Products.ERP5Security.ERP5UserManager import SUPER_USER from Products.ERP5Security.ERP5UserManager import SUPER_USER
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
......
...@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo ...@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Permissions import ManagePortal from Products.ERP5Type.Permissions import ManagePortal
from Globals import DTMLFile from Products.ERP5Type.Globals import DTMLFile
from Products.ERP5ShortMessage import _dtmldir from Products.ERP5ShortMessage import _dtmldir
class SMSTool(BaseTool): class SMSTool(BaseTool):
......
...@@ -52,7 +52,7 @@ from copy import deepcopy ...@@ -52,7 +52,7 @@ from copy import deepcopy
import logging import logging
syncml_logger = logging.getLogger('ERP5SyncML') syncml_logger = logging.getLogger('ERP5SyncML')
import sha from hashlib import sha1
from Products.ERP5SyncML.SyncMLConstant import XUPDATE_ELEMENT,\ from Products.ERP5SyncML.SyncMLConstant import XUPDATE_ELEMENT,\
XUPDATE_INSERT_OR_ADD_LIST, XUPDATE_DEL, XUPDATE_UPDATE, XUPDATE_INSERT_LIST XUPDATE_INSERT_OR_ADD_LIST, XUPDATE_DEL, XUPDATE_UPDATE, XUPDATE_INSERT_LIST
...@@ -224,7 +224,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -224,7 +224,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
def deleteWorkflowNode(): def deleteWorkflowNode():
for wf_id, wf_history_tuple in object.workflow_history.iteritems(): for wf_id, wf_history_tuple in object.workflow_history.iteritems():
for wf_history_index, wf_history in enumerate(wf_history_tuple): for wf_history_index, wf_history in enumerate(wf_history_tuple):
if sha.new(wf_id + str(wf_history['time']) + if sha1(wf_id + str(wf_history['time']) +
wf_history['actor']).hexdigest() == wf_action_id: wf_history['actor']).hexdigest() == wf_action_id:
object.workflow_history[wf_id] = ( object.workflow_history[wf_id] = (
object.workflow_history[wf_id][:wf_history_index] + object.workflow_history[wf_id][:wf_history_index] +
......
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass, DTMLFile from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from Products.ERP5 import _dtmldir from Products.ERP5 import _dtmldir
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
......
...@@ -39,7 +39,7 @@ from OFS.Image import Pdata ...@@ -39,7 +39,7 @@ from OFS.Image import Pdata
from zLOG import LOG from zLOG import LOG
from base64 import standard_b64encode from base64 import standard_b64encode
import sha from hashlib import sha1
MARSHALLER_NAMESPACE_URI = 'http://www.erp5.org/namespaces/marshaller' MARSHALLER_NAMESPACE_URI = 'http://www.erp5.org/namespaces/marshaller'
marshaller = Marshaller(namespace_uri=MARSHALLER_NAMESPACE_URI, marshaller = Marshaller(namespace_uri=MARSHALLER_NAMESPACE_URI,
...@@ -153,7 +153,7 @@ def Base_asXML(object, root=None): ...@@ -153,7 +153,7 @@ def Base_asXML(object, root=None):
elif workflow_variable == 'actor': elif workflow_variable == 'actor':
actor = variable_node.text actor = variable_node.text
workflow_node.attrib['id'] = sha.new(workflow_id + time + workflow_node.attrib['id'] = sha1(workflow_id + time +
str(actor.encode('utf-8'))).hexdigest() str(actor.encode('utf-8'))).hexdigest()
# We should now describe security settings # We should now describe security settings
......
...@@ -7,15 +7,16 @@ ...@@ -7,15 +7,16 @@
# #
from Products.CMFCore.FSZSQLMethod import FSZSQLMethod from Products.CMFCore.FSZSQLMethod import FSZSQLMethod
from Products.CMFCore.utils import expandpath
from Products.ZSQLMethods.SQL import SQL from Products.ZSQLMethods.SQL import SQL
def FSZSQLMethod_readFile(self, reparse): def FSZSQLMethod_readFile(self, reparse):
fp = expandpath(self._filepath) """Read the data from the filesystem.
file = open(fp, 'r') # not 'rb', as this is a text file! """
file = open(self._filepath, 'r') # not 'rb', as this is a text file!
try: try:
data = file.read() data = file.read()
finally: file.close() finally:
file.close()
RESPONSE = {} RESPONSE = {}
RESPONSE['BODY'] = data RESPONSE['BODY'] = data
......
...@@ -9,13 +9,12 @@ except ImportError: ...@@ -9,13 +9,12 @@ except ImportError:
from Products.CMFCore.FSObject import FSObject from Products.CMFCore.FSObject import FSObject
from Products.CMFCore.DirectoryView import registerFileExtension,\ from Products.CMFCore.DirectoryView import registerFileExtension,\
registerMetaType registerMetaType
from Products.CMFCore.utils import expandpath
else: else:
# use FileSystemSite product # use FileSystemSite product
from Products.FileSystemSite.Permissions import View from Products.FileSystemSite.Permissions import View
from Products.FileSystemSite.FSObject import FSObject from Products.FileSystemSite.FSObject import FSObject
from Products.FileSystemSite.DirectoryView import registerFileExtension,\ from Products.FileSystemSite.DirectoryView import registerFileExtension,\
registerMetaType, expandpath registerMetaType
from Products.Formulator.Form import ZMIForm from Products.Formulator.Form import ZMIForm
from Products.Formulator.XMLToForm import XMLToForm from Products.Formulator.XMLToForm import XMLToForm
...@@ -45,7 +44,7 @@ class FSForm(FSObject, ZMIForm): ...@@ -45,7 +44,7 @@ class FSForm(FSObject, ZMIForm):
return None return None
def _readFile(self, reparse): def _readFile(self, reparse):
file = open(expandpath(self._filepath), 'rb') file = open(self._filepath, 'rb')
try: try:
data = file.read() data = file.read()
finally: finally:
...@@ -63,7 +62,7 @@ class FSForm(FSObject, ZMIForm): ...@@ -63,7 +62,7 @@ class FSForm(FSObject, ZMIForm):
zLOG.LOG( zLOG.LOG(
'Formulator.FSForm', zLOG.ERROR, 'Formulator.FSForm', zLOG.ERROR,
'error reading form from file ' + 'error reading form from file ' +
expandpath(self._filepath)) self._filepath)
raise raise
#### The following is mainly taken from Form.py ACCESSORS section ### #### The following is mainly taken from Form.py ACCESSORS section ###
......
...@@ -5,7 +5,7 @@ from Acquisition import aq_base ...@@ -5,7 +5,7 @@ from Acquisition import aq_base
from App.special_dtml import DTMLFile from App.special_dtml import DTMLFile
from Persistence import Persistent from Persistence import Persistent
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.Role import RoleManager from OFS.role import RoleManager
from OFS.ObjectManager import ObjectManager from OFS.ObjectManager import ObjectManager
from OFS.PropertyManager import PropertyManager from OFS.PropertyManager import PropertyManager
from OFS.SimpleItem import Item from OFS.SimpleItem import Item
......
...@@ -8,7 +8,6 @@ from AccessControl import ClassSecurityInfo ...@@ -8,7 +8,6 @@ from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from App.class_init import default__class_init__ as InitializeClass from App.class_init import default__class_init__ as InitializeClass
from Products.CMFCore.FSPageTemplate import FSPageTemplate from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.utils import expandpath
from Products.CMFCore.DirectoryView import registerFileExtension from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.DirectoryView import registerMetaType from Products.CMFCore.DirectoryView import registerMetaType
...@@ -44,7 +43,7 @@ class FSMailTemplate(BaseMailTemplate,FSPageTemplate): ...@@ -44,7 +43,7 @@ class FSMailTemplate(BaseMailTemplate,FSPageTemplate):
security.declarePrivate('_readFile') security.declarePrivate('_readFile')
def _readFile(self, reparse): def _readFile(self, reparse):
fp = expandpath(self._filepath) fp = self._filepath
file = open(fp, 'r') # not 'rb', as this is a text file! file = open(fp, 'r') # not 'rb', as this is a text file!
try: try:
data = file.read() data = file.read()
......
...@@ -5,7 +5,7 @@ from Persistence import Persistent ...@@ -5,7 +5,7 @@ from Persistence import Persistent
from App.class_init import default__class_init__ as InitializeClass from App.class_init import default__class_init__ as InitializeClass
from Acquisition import Implicit from Acquisition import Implicit
from OFS.SimpleItem import Item from OFS.SimpleItem import Item
from AccessControl.Role import RoleManager from OFS.role import RoleManager
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.permissions import ManagePortal, ManageProperties from Products.CMFCore.permissions import ManagePortal, ManageProperties
......
...@@ -6,7 +6,8 @@ LDAP Entry Objects ...@@ -6,7 +6,8 @@ LDAP Entry Objects
__version__ = "$Revision: 1.13 $"[11:-2] __version__ = "$Revision: 1.13 $"[11:-2]
import Acquisition, AccessControl, OFS, string import Acquisition, AccessControl, OFS, string
from Globals import HTMLFile, MessageDialog; import Globals from App.special_dtml import HTMLFile
from App.Dialogs import MessageDialog
import ldap, urllib, UserList import ldap, urllib, UserList
ConnectionError='ZLDAP Connection Error' ConnectionError='ZLDAP Connection Error'
......
...@@ -11,7 +11,9 @@ __version__ = "$Revision: 1.11 $"[11:-2] ...@@ -11,7 +11,9 @@ __version__ = "$Revision: 1.11 $"[11:-2]
import Acquisition, AccessControl, OFS, string import Acquisition, AccessControl, OFS, string
from Acquisition import aq_base from Acquisition import aq_base
from Globals import HTMLFile, MessageDialog, Persistent from App.special_dtml import HTMLFile
from App.Dialogs import MessageDialog
from Persistence import Persistent
import ldap, urllib import ldap, urllib
import LDCAccessors import LDCAccessors
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# core of LDAP Filter Methods. # core of LDAP Filter Methods.
from Globals import HTMLFile, HTML
__version__ = "$Revision: 1.10 $"[11:-2] __version__ = "$Revision: 1.10 $"[11:-2]
try: try:
...@@ -17,8 +16,10 @@ import string ...@@ -17,8 +16,10 @@ import string
from Shared.DC.ZRDB import Aqueduct from Shared.DC.ZRDB import Aqueduct
from Shared.DC.ZRDB.Aqueduct import parse, decodestring, default_input_form from Shared.DC.ZRDB.Aqueduct import parse, decodestring, default_input_form
from Shared.DC.ZRDB.Results import Results from Shared.DC.ZRDB.Results import Results
import Acquisition, Globals, AccessControl.Role, OFS.SimpleItem import Acquisition, AccessControl.Role, OFS.SimpleItem
from Globals import HTMLFile, MessageDialog, Persistent from App.special_dtml import HTMLFile
from App.Dialogs import MessageDialog
from Persistence import Persistent
import DocumentTemplate import DocumentTemplate
import ExtensionClass import ExtensionClass
import sys import sys
...@@ -26,7 +27,10 @@ import sys ...@@ -26,7 +27,10 @@ import sys
from zLOG import LOG, INFO from zLOG import LOG, INFO
from ldif import LDIFRecordList, is_dn, valid_changetype_dict, CHANGE_TYPES from ldif import LDIFRecordList, is_dn, valid_changetype_dict, CHANGE_TYPES
import ldifvar import ldifvar
from AccessControl.DTML import RestrictedDTML try:
from DocumentTemplate.security import RestrictedDTML
except ImportError: # BBB Zope-2.12
from AccessControl.DTML import RestrictedDTML
try: try:
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
except ImportError: except ImportError:
...@@ -186,7 +190,7 @@ class LDAPError(Exception): ...@@ -186,7 +190,7 @@ class LDAPError(Exception):
class LDAPMethod(Aqueduct.BaseQuery, class LDAPMethod(Aqueduct.BaseQuery,
Acquisition.Implicit, Acquisition.Implicit,
Globals.Persistent, Persistent,
AccessControl.Role.RoleManager, AccessControl.Role.RoleManager,
OFS.SimpleItem.Item, OFS.SimpleItem.Item,
): ):
...@@ -564,4 +568,4 @@ pretty_results=DocumentTemplate.HTML("""\ ...@@ -564,4 +568,4 @@ pretty_results=DocumentTemplate.HTML("""\
import App.class_init import App.class_init
App.class_init.default__class_init__(LDAPMethod) App.class_init.default__class_init__(LDAPMethod)
App.class_init.default__class_init__(LDIFMethod) App.class_init.default__class_init__(LDIFMethod)
\ No newline at end of file
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from string import find, split, join, atoi, atof from string import find, split, join, atoi, atof
import sha
StringType=type('') StringType=type('')
str=__builtins__['str'] str=__builtins__['str']
......
...@@ -26,7 +26,10 @@ from DocumentTemplate.DT_Util import Eval ...@@ -26,7 +26,10 @@ from DocumentTemplate.DT_Util import Eval
from AccessControl.Permission import name_trans from AccessControl.Permission import name_trans
from SQLCatalog import CatalogError from SQLCatalog import CatalogError
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.DTML import RestrictedDTML try:
from DocumentTemplate.security import RestrictedDTML
except ImportError: # BBB Zope-2.12
from AccessControl.DTML import RestrictedDTML
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Cache import clearCache from Products.ERP5Type.Cache import clearCache
import string, sys import string, sys
......
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