Commit c3fbdacf authored by Andreas Jung's avatar Andreas Jung

replaced string module calls by string methods

parent 149eb603
...@@ -27,7 +27,7 @@ The Job of this module is to: ...@@ -27,7 +27,7 @@ The Job of this module is to:
# versions of Persistent etc get registered. # versions of Persistent etc get registered.
from BoboPOS import SimpleDB, TJar, SingleThreadedTransaction from BoboPOS import SimpleDB, TJar, SingleThreadedTransaction
import sys, os, string, Globals, OFS.Application import sys, os, Globals, OFS.Application
Globals.BobobaseName = os.path.join(Globals.data_dir, 'Data.bbb') Globals.BobobaseName = os.path.join(Globals.data_dir, 'Data.bbb')
Globals.DatabaseVersion='2' Globals.DatabaseVersion='2'
...@@ -63,7 +63,7 @@ bobo_application=app ...@@ -63,7 +63,7 @@ bobo_application=app
OFS.Application.initialize(app) OFS.Application.initialize(app)
if os.environ.has_key('ZOPE_DATABASE_QUOTA'): if os.environ.has_key('ZOPE_DATABASE_QUOTA'):
quota=string.atoi(os.environ['ZOPE_DATABASE_QUOTA']) quota=int(os.environ['ZOPE_DATABASE_QUOTA'])
Bobobase._jar.db.set_quota( Bobobase._jar.db.set_quota(
lambda x, quota=quota, otherdb=VersionBase.TDB: lambda x, quota=quota, otherdb=VersionBase.TDB:
x + otherdb.pos > quota) x + otherdb.pos > quota)
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
""" """
import Globals, OFS.PropertySheets, OFS.Image, ExtensionClass import Globals, OFS.PropertySheets, OFS.Image, ExtensionClass
from string import split, join, strip
import Acquisition, Products import Acquisition, Products
class ZClassBasicSheet(OFS.PropertySheets.PropertySheet, class ZClassBasicSheet(OFS.PropertySheets.PropertySheet,
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
import Acquisition, ExtensionClass, Globals, OFS.PropertySheets, OFS.Folder import Acquisition, ExtensionClass, Globals, OFS.PropertySheets, OFS.Folder
from AccessControl.Permission import pname from AccessControl.Permission import pname
from string import strip
import App.Dialogs, ZClasses, App.Factory, App.Product, App.ProductRegistry import App.Dialogs, ZClasses, App.Factory, App.Product, App.ProductRegistry
import ZClassOwner import ZClassOwner
from AccessControl.PermissionMapping import aqwrap, PermissionMapper from AccessControl.PermissionMapping import aqwrap, PermissionMapper
...@@ -121,26 +120,26 @@ class ZClassMethodsSheet( ...@@ -121,26 +120,26 @@ class ZClassMethodsSheet(
return id+' ' return id+' '
def _setOb(self, id, object): def _setOb(self, id, object):
self.setClassAttr(strip(id), MWp(object)) self.setClassAttr(id.strip(), MWp(object))
def _delOb(self, id): def _delOb(self, id):
self.delClassAttr(strip(id)) self.delClassAttr(id.strip())
def _delObject(self, id, dp=1): def _delObject(self, id, dp=1):
# Ick! This is necessary to deal with spaces. Waaa! # Ick! This is necessary to deal with spaces. Waaa!
object=self._getOb(id) object=self._getOb(id)
object.manage_beforeDelete(object, self) object.manage_beforeDelete(object, self)
id=strip(id) id=id.strip()
self._objects=tuple(filter(lambda i,n=id: self._objects=tuple(filter(lambda i,n=id:
strip(i['id']) != n, i['id'].strip() != n,
self._objects)) self._objects))
self._delOb(id) self._delOb(id)
def _getOb(self, id, default=_marker): def _getOb(self, id, default=_marker):
if default is _marker: if default is _marker:
r=self.getClassAttr(strip(id)) r=self.getClassAttr(id.strip())
else: else:
try: r=self.getClassAttr(strip(id)) try: r=self.getClassAttr(id.strip())
except: return default except: return default
if hasattr(r, methodattr): if hasattr(r, methodattr):
...@@ -157,7 +156,7 @@ class ZClassMethodsSheet( ...@@ -157,7 +156,7 @@ class ZClassMethodsSheet(
m._permissionMapper=wrapper m._permissionMapper=wrapper
mw=MWp(m) mw=MWp(m)
self.setClassAttr(strip(id), mw) self.setClassAttr(id.strip(), mw)
r=m r=m
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
import OFS.PropertySheets, Globals, OFS.SimpleItem, OFS.PropertyManager import OFS.PropertySheets, Globals, OFS.SimpleItem, OFS.PropertyManager
import Acquisition import Acquisition
from string import join, upper
from AccessControl.Permission import pname from AccessControl.Permission import pname
class ClassCaretaker: class ClassCaretaker:
...@@ -89,7 +88,7 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item): ...@@ -89,7 +88,7 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
a=r.append a=r.append
for p in self.propertyMap(): for p in self.propertyMap():
pid=p['id'] pid=p['id']
pid=upper(pid[:1])+pid[1:] pid=pid[:1].upper()+pid[1:]
a(' <tr><th align=left valign=top>%s</th>' % pid) a(' <tr><th align=left valign=top>%s</th>' % pid)
a(' <td align=left valign=top>%s</td>' % a(' <td align=left valign=top>%s</td>' %
self._view_widget_for_type(p['type'], p['id']) self._view_widget_for_type(p['type'], p['id'])
...@@ -97,7 +96,7 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item): ...@@ -97,7 +96,7 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
a(' </tr>') a(' </tr>')
a('</table>') a('</table>')
a('<dtml-var standard_html_footer>') a('<dtml-var standard_html_footer>')
r=join(r,'\n') r='\n'.join(r)
self.aq_parent.aq_parent.methods.manage_addDTMLMethod(id, title, r) self.aq_parent.aq_parent.methods.manage_addDTMLMethod(id, title, r)
if REQUEST is not None: if REQUEST is not None:
REQUEST['RESPONSE'].redirect(REQUEST['URL3']+'/methods/manage') REQUEST['RESPONSE'].redirect(REQUEST['URL3']+'/methods/manage')
...@@ -185,7 +184,7 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item): ...@@ -185,7 +184,7 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
a(' </td></tr>') a(' </td></tr>')
a('</table></form>') a('</table></form>')
a('</body></html>') a('</body></html>')
r=join(r,'\n') r='\n'.join(r)
self.aq_parent.aq_parent.methods.manage_addDTMLMethod(id, title, r) self.aq_parent.aq_parent.methods.manage_addDTMLMethod(id, title, r)
if REQUEST is not None: if REQUEST is not None:
REQUEST['RESPONSE'].redirect(REQUEST['URL3']+'/methods/manage') REQUEST['RESPONSE'].redirect(REQUEST['URL3']+'/methods/manage')
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################## ##############################################################################
"""Zope Classes """Zope Classes
""" """
import Globals, string, OFS.SimpleItem, OFS.PropertySheets, Products import Globals, OFS.SimpleItem, OFS.PropertySheets, Products
import Method, Basic, Property, AccessControl.Role, re import Method, Basic, Property, AccessControl.Role, re
from ZPublisher.mapply import mapply from ZPublisher.mapply import mapply
...@@ -73,9 +73,9 @@ def createZClassForBase( base_class, pack, nice_name=None, meta_type=None ): ...@@ -73,9 +73,9 @@ def createZClassForBase( base_class, pack, nice_name=None, meta_type=None ):
key = "%s/%s" % (base_module, base_name) key = "%s/%s" % (base_module, base_name)
if base_module[:9] == 'Products.': if base_module[:9] == 'Products.':
base_module = string.split( base_module,'.' )[1] base_module = base_module.split('.' )[1]
else: else:
base_module = string.split( base_module,'.' )[0] base_module = base_module.split('.' )[0]
info="%s: %s" % ( base_module, base_name ) info="%s: %s" % ( base_module, base_name )
...@@ -331,7 +331,7 @@ class ZClass( Base ...@@ -331,7 +331,7 @@ class ZClass( Base
id.update(self.absolute_url()) id.update(self.absolute_url())
id.update(str(time.time())) id.update(str(time.time()))
id=id.digest() id=id.digest()
id=string.strip(base64.encodestring(id)) id=base64.encodestring(id).strip()
return '*'+id return '*'+id
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
import time, sys, string, os, thread import time, sys, os, thread
from zLOG import severity_string, log_time, format_exception from zLOG import severity_string, log_time, format_exception
...@@ -49,7 +49,7 @@ def stupid_log_write(subsystem, severity, summary, detail, error): ...@@ -49,7 +49,7 @@ def stupid_log_write(subsystem, severity, summary, detail, error):
global _stupid_severity global _stupid_severity
if _stupid_severity is None: if _stupid_severity is None:
try: _stupid_severity=string.atoi(os.environ['STUPID_LOG_SEVERITY']) try: _stupid_severity=int(os.environ['STUPID_LOG_SEVERITY'])
except: _stupid_severity=0 except: _stupid_severity=0
if severity < _stupid_severity: return if severity < _stupid_severity: return
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
from syslog import syslog_client, LOG_ALERT, LOG_ERR, LOG_WARNING, LOG_NOTICE from syslog import syslog_client, LOG_ALERT, LOG_ERR, LOG_WARNING, LOG_NOTICE
from syslog import LOG_INFO, LOG_DEBUG from syslog import LOG_INFO, LOG_DEBUG
import os, string, traceback import os, traceback
pid_str='[%s]: ' % os.getpid() pid_str='[%s]: ' % os.getpid()
...@@ -23,7 +23,7 @@ class syslogLogger: ...@@ -23,7 +23,7 @@ class syslogLogger:
def __init__(self): def __init__(self):
if os.environ.has_key('ZSYSLOG_SERVER'): if os.environ.has_key('ZSYSLOG_SERVER'):
(addr, port) = string.split(os.environ['ZSYSLOG_SERVER'], ':') (addr, port) = os.environ['ZSYSLOG_SERVER'].split(':')
self.client = syslog_client((addr, int(port))) self.client = syslog_client((addr, int(port)))
self.on = 1 self.on = 1
elif os.environ.has_key('ZSYSLOG'): elif os.environ.has_key('ZSYSLOG'):
......
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