Commit f2be2bb6 authored by Andreas Jung's avatar Andreas Jung

string module free zone

parent 36babae5
......@@ -7,7 +7,6 @@ from Globals import DTMLFile, MessageDialog, Persistent
from OFS.SimpleItem import Item
from Acquisition import Implicit, ImplicitAcquisitionWrapper
from ExtensionClass import Base
from string import split, strip
from ZPublisher import BeforeTraverse
import os
......@@ -81,9 +80,9 @@ class SiteRoot(Traverser, Implicit):
def __init__(self, title, base, path):
'''Title'''
self.title = strip(title)
self.base = base = strip(base)
self.path = path = strip(path)
self.title = title.strip()
self.base = base = base.strip()
self.path = path = path.strip()
if base: self.SiteRootBASE = base
else:
try: del self.SiteRootBASE
......
......@@ -6,7 +6,6 @@ Defines the VirtualHostMonster class
from Globals import DTMLFile, MessageDialog, Persistent
from OFS.SimpleItem import Item
from Acquisition import Implicit, aq_inner, aq_parent
from string import split, strip, join, find, lower, replace
from ZPublisher import BeforeTraverse
import os
......@@ -34,22 +33,22 @@ class VirtualHostMonster(Persistent, Item, Implicit):
def set_map(self, map_text, RESPONSE=None):
"Set domain to path mappings."
lines = split(map_text, '\n')
lines = map_text.split('\n')
self.fixed_map = fixed_map = {}
self.sub_map = sub_map = {}
new_lines = []
for line in lines:
line = strip(split(line, '#!')[0])
line = line.split('#!')[0].strip()
if not line:
continue
try:
# Drop the protocol, if any
line = split(line, '://')[-1]
line = line.split('://')[-1]
try:
host, path = map(strip, split(line, '/', 1))
host, path = [x.strip() for x in line.split('/', 1)]
except:
raise 'LineError', 'Needs a slash between host and path'
pp = filter(None, split(path, '/'))
pp = filter(None, path.split( '/'))
if pp:
obpath = pp[:]
if obpath[0] == 'VirtualHostBase':
......@@ -71,7 +70,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
pp.append('/')
pp.reverse()
try:
int(replace(host,'.',''))
int(host.replace('.',''))
raise 'LineError', 'IP addresses are not mappable'
except ValueError:
pass
......@@ -80,7 +79,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
host = host[2:]
else:
host_map = fixed_map
hostname, port = (split(host, ':', 1) + [None])[:2]
hostname, port = (host.split( ':', 1) + [None])[:2]
if not host_map.has_key(hostname):
host_map[hostname] = {}
host_map[hostname][port] = pp
......@@ -130,7 +129,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
protocol = stack.pop()
host = stack.pop()
if ':' in host:
host, port = split(host, ':')
host, port = host.split(':')
request.setServerURL(protocol, host, port)
else:
request.setServerURL(protocol, host)
......@@ -148,9 +147,9 @@ class VirtualHostMonster(Persistent, Item, Implicit):
if vh >= 0:
for jj in range(vh, ii):
pp.insert(1, stack[jj][4:])
stack[vh:ii + 1] = [join(pp, '/'), self.id]
stack[vh:ii + 1] = ['/'.join(pp), self.id]
elif ii > 0 and stack[ii - 1][:1] == '/':
pp = split(stack[ii - 1], '/')
pp = stack[ii - 1].split('/')
stack[ii] = self.id
else:
stack[ii] = self.id
......@@ -169,8 +168,8 @@ class VirtualHostMonster(Persistent, Item, Implicit):
vh_used = 1 # Only retry once.
# Try to apply the host map if one exists, and if no
# VirtualHost directives were found.
host = lower(split(request['SERVER_URL'], '://')[1])
hostname, port = (split(host, ':', 1) + [None])[:2]
host = request['SERVER_URL'].split('://')[1].lower()
hostname, port = (host.split( ':', 1) + [None])[:2]
ports = self.fixed_map.get(hostname, 0)
if not ports and self.sub_map:
get = self.sub_map.get
......@@ -180,7 +179,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
break
if '.' not in hostname:
return
hostname = split(hostname, '.', 1)[1]
hostname = hostname.split('.', 1)[1]
if ports:
pp = ports.get(port, 0)
if pp == 0 and port is not None:
......
......@@ -12,13 +12,12 @@
##############################################################################
"""Mounted database support
$Id: TemporaryFolder.py,v 1.4 2001/11/28 15:51:08 matt Exp $"""
__version__='$Revision: 1.4 $'[11:-2]
$Id: TemporaryFolder.py,v 1.5 2002/03/11 16:09:19 andreasjung Exp $"""
__version__='$Revision: 1.5 $'[11:-2]
import Globals
from Globals import HTMLFile
from ZODB.Mount import MountPoint
import string
import OFS
import os, os.path
......
......@@ -16,7 +16,6 @@ import Acquisition
import ExtensionClass
from Products.PluginIndexes.TextIndex.Lexicon import Lexicon
from MultiMapping import MultiMapping
from string import lower
import Record
from Missing import MV
from zLOG import LOG, ERROR
......@@ -593,7 +592,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
so=kw['sort_order']
else: so=None
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
so.lower() in ('reverse', 'descending')):
r.reverse()
r=map(lambda i: i[1], r)
......
......@@ -17,7 +17,7 @@
backward-compatibility. All new code should use CatalogPathAwareness.
"""
import urllib, string
import urllib
from Globals import DTMLFile
class CatalogAware:
......@@ -74,7 +74,7 @@ class CatalogAware:
for user, roles in self.get_local_roles():
if 'Owner' in roles:
users.append(user)
return string.join(users, ', ')
return ', '.join(users)
def onDeleteObject(self):
"""Object delete handler. I think this is obsoleted by
......@@ -92,7 +92,7 @@ class CatalogAware:
script_name=self.REQUEST['SCRIPT_NAME']
__traceback_info__=(`uri`, `script_name`)
if script_name:
uri=filter(None, string.split(uri, script_name))[0]
uri=filter(None, uri.split(script_name))[0]
if not uri:
uri = '/'
if uri[0] != '/':
......
......@@ -13,7 +13,7 @@
"""ZCatalog Findable class"""
import urllib, string
import urllib
from Globals import DTMLFile
from Acquisition import aq_base
......@@ -71,7 +71,7 @@ class CatalogAware:
for user, roles in self.get_local_roles():
if 'Owner' in roles:
users.append(user)
return string.join(users, ', ')
return ', '.join(users, ', ')
def onDeleteObject(self):
"""Object delete handler. I think this is obsoleted by
......@@ -80,7 +80,7 @@ class CatalogAware:
def getPath(self):
"""Return the physical path for an object."""
return string.join(self.getPhysicalPath(), '/')
return '/'.join(self.getPhysicalPath())
def summary(self, num=200):
"""Return a summary of the text content of the object."""
......
......@@ -32,7 +32,7 @@ from ZCatalogIndexes import ZCatalogIndexes
from Products.PluginIndexes.common.PluggableIndex import PluggableIndexInterface
from Products.PluginIndexes.TextIndex.Vocabulary import Vocabulary
from Products.PluginIndexes.TextIndex import Splitter
import string, urllib, os, sys, time, types
import urllib, os, sys, time, types
......@@ -211,7 +211,7 @@ class ZCatalog(Folder, Persistent, Implicit):
def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None):
""" edit the catalog """
if type(threshold) is not type(1):
threshold=string.atoi(threshold)
threshold=int(threshold)
self.threshold = threshold
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Catalog%20Changed')
......@@ -312,7 +312,7 @@ class ZCatalog(Folder, Persistent, Implicit):
words = 0
obj = REQUEST.PARENTS[1]
path = string.join(obj.getPhysicalPath(), '/')
path = '/'.join(obj.getPhysicalPath())
results = self.ZopeFindAndApply(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