1919import getopt
2020
2121from cgi import escape
22- from string import join , lower , rfind
23- try :
24- from strop import lower , rfind
25- except ImportError :
26- pass
2722
2823try :
2924 from cStringIO import StringIO
@@ -163,10 +158,9 @@ def __call__(self):
163158 self ._stream_write ("\n " )
164159 self .col = 0
165160
166- def stream_write (self , s ,
167- len = len , rfind = rfind ):
161+ def stream_write (self , s , len = len ):
168162 self ._stream_write (s )
169- i = rfind (s , '\n ' )
163+ i = s . rfind ('\n ' )
170164 if i < 0 :
171165 self .col = self .col + len (s )
172166 else :
@@ -272,7 +266,7 @@ def attrAction(self, item):
272266 # Clear 'entering' flag
273267 macs [- 1 ][2 ] = 0
274268 # Convert or drop depth-one METAL attributes.
275- i = rfind (name , ":" ) + 1
269+ i = name . rfind (":" ) + 1
276270 prefix , suffix = name [:i ], name [i :]
277271 if suffix == "define-macro" :
278272 # Convert define-macro as we enter depth one.
@@ -296,7 +290,7 @@ def attrAction_tal(self, item):
296290 if action > 1 :
297291 return self .attrAction (item )
298292 ok = 1
299- if self .html and lower (name ) in BOOLEAN_HTML_ATTRS :
293+ if self .html and name . lower () in BOOLEAN_HTML_ATTRS :
300294 evalue = self .engine .evaluateBoolean (item [3 ])
301295 if evalue is self .Default :
302296 if action == 1 : # Cancelled insert
@@ -424,7 +418,7 @@ def do_insertText_tal(self, stuff):
424418 return
425419 s = escape (text )
426420 self ._stream_write (s )
427- i = rfind (s , '\n ' )
421+ i = s . rfind ('\n ' )
428422 if i < 0 :
429423 self .col = self .col + len (s )
430424 else :
0 commit comments