Commit 8f12e4a1 authored by Andreas Jung's avatar Andreas Jung

replace string module calls by string methods

parent d0de6597
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
from DT_Util import parse_params, name_param, str from DT_Util import parse_params, name_param, str
import string, sys import sys
class ReturnTag: class ReturnTag:
name='return' name='return'
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
# #
############################################################################## ##############################################################################
import string, sys, traceback import sys, traceback
from StringIO import StringIO from cStringIO import StringIO
from DT_Util import ParseError, parse_params, render_blocks from DT_Util import ParseError, parse_params, render_blocks
from DT_Util import namespace, InstanceDict from DT_Util import namespace, InstanceDict
from DT_Return import DTReturn from DT_Return import DTReturn
......
...@@ -145,11 +145,11 @@ Evaluating expressions without rendering results ...@@ -145,11 +145,11 @@ Evaluating expressions without rendering results
''' # ' ''' # '
__rcs_id__='$Id: DT_Var.py,v 1.49 2001/11/28 15:50:55 matt Exp $' __rcs_id__='$Id: DT_Var.py,v 1.50 2002/02/07 17:47:42 andreasjung Exp $'
__version__='$Revision: 1.49 $'[11:-2] __version__='$Revision: 1.50 $'[11:-2]
from DT_Util import parse_params, name_param, str from DT_Util import parse_params, name_param, str
import re, string, sys import string, re, sys
from urllib import quote, quote_plus from urllib import quote, quote_plus
from cgi import escape from cgi import escape
from html_quote import html_quote # for import by other modules, dont remove! from html_quote import html_quote # for import by other modules, dont remove!
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
__doc__='''Python implementations of document template some features __doc__='''Python implementations of document template some features
$Id: pDocumentTemplate.py,v 1.33 2001/11/28 15:50:55 matt Exp $''' $Id: pDocumentTemplate.py,v 1.34 2002/02/07 17:47:42 andreasjung Exp $'''
__version__='$Revision: 1.33 $'[11:-2] __version__='$Revision: 1.34 $'[11:-2]
import string, sys, types import sys, types
ClassTypes = [types.ClassType] ClassTypes = [types.ClassType]
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
Advanced sort support by Oleg Broytmann <phd@@phd.pp.ru> 23 Apr 2001 Advanced sort support by Oleg Broytmann <phd@@phd.pp.ru> 23 Apr 2001
eg Sort(sequence, (("akey", "nocase"), ("anotherkey", "cmp", "desc"))) eg Sort(sequence, (("akey", "nocase"), ("anotherkey", "cmp", "desc")))
$Id: SortEx.py,v 1.3 2001/11/28 15:50:55 matt Exp $ $Id: SortEx.py,v 1.4 2002/02/07 17:47:42 andreasjung Exp $
""" """
from string import lower
TupleType=type(()) TupleType=type(())
...@@ -132,14 +132,14 @@ basic_type={type(''): 1, type(0): 1, type(0.0): 1, type(()): 1, type([]): 1, ...@@ -132,14 +132,14 @@ basic_type={type(''): 1, type(0): 1, type(0.0): 1, type(()): 1, type([]): 1,
type(None) : 1 }.has_key type(None) : 1 }.has_key
def nocase(str1, str2): def nocase(str1, str2):
return cmp(lower(str1), lower(str2)) return cmp(str1.lower(), str2.lower())
import sys import sys
if sys.modules.has_key("locale"): # only if locale is already imported if sys.modules.has_key("locale"): # only if locale is already imported
from locale import strcoll from locale import strcoll
def strcoll_nocase(str1, str2): def strcoll_nocase(str1, str2):
return strcoll(lower(str1), lower(str2)) return strcoll(str1.lower(), str2.lower())
def make_sortfunctions(sortfields, _): def make_sortfunctions(sortfields, _):
...@@ -175,7 +175,7 @@ def make_sortfunctions(sortfields, _): ...@@ -175,7 +175,7 @@ def make_sortfunctions(sortfields, _):
else: # no - look it up in the namespace else: # no - look it up in the namespace
func = _.getitem(f_name, 0) func = _.getitem(f_name, 0)
sort_order = lower(f[2]) sort_order = f[2].lower()
if sort_order == "asc": if sort_order == "asc":
multiplier = +1 multiplier = +1
......
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