Commit efaee02a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

remove deprecation warnings.

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