[Zope-Checkins] CVS: Zope/lib/python/TreeDisplay - TreeTag.py:1.50

Andreas Jung andreas@digicool.com
Thu, 7 Feb 2002 13:06:26 -0500


Update of /cvs-repository/Zope/lib/python/TreeDisplay
In directory cvs.zope.org:/tmp/cvs-serv25196

Modified Files:
	TreeTag.py 
Log Message:
replace string module calls by string methods


=== Zope/lib/python/TreeDisplay/TreeTag.py 1.49 => 1.50 ===
 from DocumentTemplate.DT_String import String
 
-from string import join, split, rfind, find, translate, replace
+from string import translate
 from urllib import quote, unquote
 from zlib import compress, decompress
 from binascii import b2a_base64, a2b_base64
 import re
 
-tbl=join(map(chr, range(256)),'')
+tbl=''.join(map(chr, range(256))
 tplus=tbl[:ord('+')]+'-'+tbl[ord('+')+1:]
 tminus=tbl[:ord('-')]+'+'+tbl[ord('-')+1:]
 
@@ -178,7 +178,7 @@
 
         url=''
         root=md['URL']
-        l=rfind(root,'/')
+        l=root.rfind('/')
         if l >= 0: root=root[l+1:]
 
     treeData={'tree-root-url': root,
@@ -188,7 +188,7 @@
     prefix = args.get('prefix')
     if prefix:
         for k, v in treeData.items():
-            treeData[prefix + replace(k[4:], '-', '_')] = v
+            treeData[prefix + k[4:].replace('-', '_')] = v
     
     md._push(InstanceDict(self, md))
     md._push(treeData)
@@ -202,7 +202,7 @@
         state=encode_seq(state)
         md['RESPONSE'].setCookie('tree-s',state)
 
-    return join(data,'')
+    return ''.join(data)
 
 def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data,
                   colspan, section, md, treeData, level=0, args=None,
@@ -327,7 +327,7 @@
             if len(s) > 57: s=encode_str(s)
             else:
                 s=b2a_base64(s)[:-1]
-                l=find(s,'=')
+                l=s.find('=')
                 if l >= 0: s=s[:l]
             s=translate(s, tplus)
             ####################################
@@ -521,10 +521,10 @@
         states=[]
         for i in range(0,l,57):
             states.append(b2a_base64(state[i:i+57])[:-1])
-        state=join(states,'')
+        state=''.join(states)
     else: state=b2a_base64(state)[:-1]
 
-    l=find(state,'=')
+    l=state.find('=')
     if l >= 0: state=state[:l]
     
     state=translate(state, tplus)
@@ -538,10 +538,10 @@
         states=[]
         for i in range(0,l,57):
             states.append(b2a_base64(state[i:i+57])[:-1])
-        state=join(states,'')
+        state=''.join(states)
     else: state=b2a_base64(state)[:-1]
 
-    l=find(state,'=')
+    l=state.find('=')
     if l >= 0: state=state[:l]
         
     state=translate(state, tplus)
@@ -566,7 +566,7 @@
             k=l%4
             if k: state=state+'='*(4-k)
             states.append(a2b_base64(state))
-        state=join(states,'')
+        state=''.join(states)
     else:
         l=len(state)
         k=l%4
@@ -574,7 +574,7 @@
         state=a2b_base64(state)
 
     state=decompress(state)
-    if find(state,'*') >= 0: raise 'Illegal State', state
+    if state.find('*') >= 0: raise 'Illegal State', state
     try: return list(eval(state,{'__builtins__':{}}))
     except: return []