[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - DT_HTML.py:1.32 DT_If.py:1.19 DT_In.py:1.60 DT_InSV.py:1.22 DT_Let.py:1.13 DT_Raise.py:1.13 DT_Return.py:1.7 DT_String.py:1.51 DT_Try.py:1.13 DT_UI.py:1.12 DT_Util.py:1.88 DT_Var.py:1.57 DT_With.py:1.15 DTtestExpr.py:1.8 DocumentTemplate.py:1.14 VSEval.py:1.28 __init__.py:1.17 html_quote.py:1.3 pDocumentTemplate.py:1.36
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:30:23 -0400
Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv29098/DocumentTemplate
Modified Files:
DT_HTML.py DT_If.py DT_In.py DT_InSV.py DT_Let.py DT_Raise.py
DT_Return.py DT_String.py DT_Try.py DT_UI.py DT_Util.py
DT_Var.py DT_With.py DTtestExpr.py DocumentTemplate.py
VSEval.py __init__.py html_quote.py pDocumentTemplate.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/DocumentTemplate/DT_HTML.py 1.31 => 1.32 ===
--- Zope/lib/python/DocumentTemplate/DT_HTML.py:1.31 Wed Nov 28 10:50:54 2001
+++ Zope/lib/python/DocumentTemplate/DT_HTML.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""HTML formated DocumentTemplates
@@ -71,7 +71,7 @@
else:
if text[s:s+5] == '&dtml' and text[s+5] in '.-':
n=s+6
- e=text.find(';',n)
+ e=text.find(';',n)
if e >= 0:
args=text[n:e]
l=len(args)
@@ -97,7 +97,7 @@
d[3]=d['args']=args
self._start = s
return self
-
+
start=s+1
continue
@@ -106,7 +106,7 @@
mo = name_match(text,n)
if mo is None: return None
l = mo.end(0) - mo.start(0)
-
+
a=n+l
name=text[n:a].strip()
@@ -177,7 +177,7 @@
if not (args==sargs or
args==sargs[:l] and sargs[l:l+1] in ' \t\n'):
return tag, args, self.commands[name], None
-
+
return tag, args, None, name
try: return tag, args, self.commands[name], None
@@ -225,7 +225,7 @@
manage_editForm__roles__=()
def manage_editForm(self, URL1, REQUEST):
'''Display doc template editing form''' #"
-
+
return self._manage_editForm(
self,
mapping=REQUEST,
@@ -302,7 +302,7 @@
if data.find('\r'):
data='\n\r'.join(data.split('\r\n'))
data='\n'.join(data.split('\n\r'))
-
+
if self.edited_source:
self.edited_source=data
self._v_cooked=self.cook()
=== Zope/lib/python/DocumentTemplate/DT_If.py 1.18 => 1.19 ===
--- Zope/lib/python/DocumentTemplate/DT_If.py:1.18 Wed Nov 28 10:50:54 2001
+++ Zope/lib/python/DocumentTemplate/DT_If.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Conditional insertion
@@ -19,14 +19,14 @@
format, use::
%(if name)[
- text
+ text
%(if name)]
To include text when an object is true using the HTML
format, use::
<!--#if name-->
- text
+ text
<!--#/if name-->
where 'name' is the name bound to the object.
@@ -35,14 +35,14 @@
format, use::
%(else name)[
- text
+ text
%(else name)]
To include text when an object is false using the HTML
format, use::
<!--#else name-->
- text
+ text
<!--#/else name-->
Finally to include text when an object is true and to
@@ -50,10 +50,10 @@
EPFS format, use::
%(if name)[
- true text
+ true text
%(if name)]
%(else name)[
- false text
+ false text
%(else name)]
and to include text when an object is true and to
@@ -61,9 +61,9 @@
HTML format, use::
<!--#if name-->
- true text
+ true text
<!--#else name-->
- false text
+ false text
<!--#/if name-->
Notes:
@@ -74,7 +74,7 @@
is used inside the tag, including in enclosed tags, the
variable is not reevaluated.
-'''
+'''
__rcs_id__='$Id$'
__version__='$Revision$'[11:-2]
=== Zope/lib/python/DocumentTemplate/DT_In.py 1.59 => 1.60 ===
--- Zope/lib/python/DocumentTemplate/DT_In.py:1.59 Tue May 7 13:55:37 2002
+++ Zope/lib/python/DocumentTemplate/DT_In.py Wed Aug 14 18:29:52 2002
@@ -1,20 +1,20 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
'''Sequence insertion
A sequence may be inserted using an 'in' command. The 'in'
command specifies the name of a sequence object and text to
- be inserted for each element in the sequence.
+ be inserted for each element in the sequence.
The EPFS syntax for the in command is::
@@ -25,7 +25,7 @@
The HTML syntax for the in command is::
<!--#in name-->
- text
+ text
<!--#/in name-->
See the example below that shows how 'if', 'else', and 'in' commands
@@ -70,7 +70,7 @@
sort_expr -- This allows an expression to control sort order.
reverse -- Reverse the sequence (may be combined with sort). Note
- that this can cause a huge memory use in lazy activation instances.
+ that this can cause a huge memory use in lazy activation instances.
reverse_expr -- This calculated parameter allows you to calculate the
need of reversing on the fly.
@@ -160,7 +160,7 @@
parameter is 0.
'overlap' -- The desired overlap between batches. The
- default is no overlap.
+ default is no overlap.
Typically, only 'start' and 'size' will be specified.
@@ -360,7 +360,7 @@
start_name_re=None
reverse=None
sort_expr=reverse_expr=None
-
+
def __init__(self, blocks):
tname, args, section = blocks[0]
args=parse_params(args, name='', start='1',end='-1',size='10',
@@ -385,10 +385,10 @@
if has_key('reverse'):
self.reverse=args['reverse']
-
+
if has_key('no_push_item'):
self.no_push_item=args['no_push_item']
-
+
if has_key('mapping'): self.mapping=args['mapping']
for n in 'start', 'size', 'end':
if has_key(n): self.batch=1
@@ -397,7 +397,7 @@
if prefix and not simple_name(prefix):
raise ParseError, _tm(
'prefix is not a simple name', 'in')
-
+
for n in 'orphan','overlap','previous','next':
if has_key(n) and not self.batch:
raise ParseError, (
@@ -417,7 +417,7 @@
'&+'+
''.join(["[%s]" % c for c in v])+
'=[0-9]+&+')
-
+
name,expr=name_param(args,'in',1)
if expr is not None: expr=expr.eval
self.__name__, self.expr = name, expr
@@ -433,7 +433,7 @@
raise ParseError, (
'name in else does not match in', 'in')
self.elses=section.blocks
-
+
def renderwb(self, md):
expr=self.expr
@@ -456,7 +456,7 @@
section=self.section
params=self.args
-
+
mapping=self.mapping
no_push_item=self.no_push_item
@@ -470,7 +470,7 @@
sequence=self.reverse_sequence(sequence)
elif self.reverse is not None:
sequence=self.reverse_sequence(sequence)
-
+
next=previous=0
try: start=int_param(params,md,'start',0)
except: start=1
@@ -570,7 +570,7 @@
pkw['next-sequence-end-index']=pend-1
pkw['next-sequence-size']=pend+1-pstart
except: pass
-
+
if index==last: pkw['sequence-end']=1
if guarded_getitem is not None:
@@ -636,7 +636,7 @@
raise 'InError', (
'Strings are not allowed as input to the in tag.')
- section=self.section
+ section=self.section
mapping=self.mapping
no_push_item=self.no_push_item
@@ -669,46 +669,46 @@
if cache: push(cache)
push(vars)
try:
- result = []
- append=result.append
- guarded_getitem = getattr(md, 'guarded_getitem', None)
- for index in range(l):
- if index==last: pkw['sequence-end']=1
- if guarded_getitem is not None:
- try: client = guarded_getitem(sequence, index)
- except ValidationError, vv:
- if (self.args.has_key('skip_unauthorized') and
- self.args['skip_unauthorized']):
- if index==1: pkw['sequence-start']=0
- continue
- raise ValidationError, '(item %s): %s' % (
- index, vv), sys.exc_info()[2]
- else:
- client = sequence[index]
-
- pkw['sequence-index']=index
- t = type(client)
- if t is TupleType and len(client)==2:
- client=client[1]
+ result = []
+ append=result.append
+ guarded_getitem = getattr(md, 'guarded_getitem', None)
+ for index in range(l):
+ if index==last: pkw['sequence-end']=1
+ if guarded_getitem is not None:
+ try: client = guarded_getitem(sequence, index)
+ except ValidationError, vv:
+ if (self.args.has_key('skip_unauthorized') and
+ self.args['skip_unauthorized']):
+ if index==1: pkw['sequence-start']=0
+ continue
+ raise ValidationError, '(item %s): %s' % (
+ index, vv), sys.exc_info()[2]
+ else:
+ client = sequence[index]
- if no_push_item:
- pushed = 0
- elif mapping:
- pushed = 1
- push(client)
- elif t in StringTypes:
- pushed = 0
- else:
- pushed = 1
- push(InstanceDict(client, md))
+ pkw['sequence-index']=index
+ t = type(client)
+ if t is TupleType and len(client)==2:
+ client=client[1]
+
+ if no_push_item:
+ pushed = 0
+ elif mapping:
+ pushed = 1
+ push(client)
+ elif t in StringTypes:
+ pushed = 0
+ else:
+ pushed = 1
+ push(InstanceDict(client, md))
- try: append(render(section, md))
- finally:
- if pushed:
- pop()
- if index==0: pkw['sequence-start']=0
+ try: append(render(section, md))
+ finally:
+ if pushed:
+ pop()
+ if index==0: pkw['sequence-start']=0
- result = join_unicode(result)
+ result = join_unicode(result)
finally:
if cache: pop()
@@ -721,7 +721,7 @@
# Modified with multiple sort fields by Ross Lazarus
# April 7 2000 rossl@med.usyd.edu.au
# eg <dtml-in "foo" sort="akey,anotherkey">
-
+
# Modified with advanced sort functions by
# Oleg Broytmann <phd@phd.pp.ru> 30 Mar 2001
# eg <dtml-in "foo" sort="akey/nocase,anotherkey/cmp/desc">
@@ -729,7 +729,7 @@
sort=self.sort
need_sortfunc = sort.find('/') >= 0
- sortfields = sort.split(',') # multi sort = key1,key2
+ sortfields = sort.split(',') # multi sort = key1,key2
multsort = len(sortfields) > 1 # flag: is multiple sort
if need_sortfunc:
@@ -756,25 +756,25 @@
v=client
if sort:
- if multsort: # More than one sort key.
- k = []
- for sk in sortfields:
- try:
- if mapping: akey = v[sk]
- else: akey = getattr(v, sk)
- except AttributeError, KeyError: akey = None
- if not basic_type(akey):
- try: akey = akey()
- except: pass
- k.append(akey)
- else: # One sort key.
- try:
- if mapping: k = v[sort]
- else: k = getattr(v, sort)
- except AttributeError, KeyError: k = None
- if not basic_type(type(k)):
- try: k = k()
- except: pass
+ if multsort: # More than one sort key.
+ k = []
+ for sk in sortfields:
+ try:
+ if mapping: akey = v[sk]
+ else: akey = getattr(v, sk)
+ except AttributeError, KeyError: akey = None
+ if not basic_type(akey):
+ try: akey = akey()
+ except: pass
+ k.append(akey)
+ else: # One sort key.
+ try:
+ if mapping: k = v[sort]
+ else: k = getattr(v, sort)
+ except AttributeError, KeyError: k = None
+ if not basic_type(type(k)):
+ try: k = k()
+ except: pass
s.append((k,client))
@@ -786,7 +786,7 @@
sequence=[]
for k, client in s:
- sequence.append(client)
+ sequence.append(client)
return sequence
def reverse_sequence(self, sequence):
=== Zope/lib/python/DocumentTemplate/DT_InSV.py 1.21 => 1.22 ===
--- Zope/lib/python/DocumentTemplate/DT_InSV.py:1.21 Wed Nov 28 10:50:54 2001
+++ Zope/lib/python/DocumentTemplate/DT_InSV.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Sequence variables support
@@ -28,10 +28,10 @@
class sequence_variables:
alt_prefix = None
-
+
def __init__(self,items=None,query_string='',start_name_re=None,
alt_prefix=''):
-
+
self.items=items
self.query_string=query_string
self.start_name_re=start_name_re
@@ -68,35 +68,35 @@
roman = ''
while num >= 1000:
- num = num - 1000
- roman = '%sM' % roman
+ num = num - 1000
+ roman = '%sM' % roman
while num >= 500:
- num = num - 500
- roman = '%sD' % roman
+ num = num - 500
+ roman = '%sD' % roman
while num >= 100:
- num = num - 100
- roman = '%sC' % roman
+ num = num - 100
+ roman = '%sC' % roman
while num >= 50:
- num = num - 50
- roman = '%sL' % roman
+ num = num - 50
+ roman = '%sL' % roman
while num >= 10:
- num = num - 10
- roman = '%sX' % roman
+ num = num - 10
+ roman = '%sX' % roman
while num >= 5:
- num = num - 5
- roman = '%sV' % roman
+ num = num - 5
+ roman = '%sV' % roman
while num < 5 and num >= 1:
- num = num - 1
- roman = '%sI' % roman
+ num = num - 1
+ roman = '%sI' % roman
# Replaces special cases in Roman Numerals
-
+
roman = roman.replace('DCCCC', 'CM')
roman = roman.replace('CCCC', 'CD')
roman = roman.replace('LXXXX', 'XC')
@@ -132,7 +132,7 @@
return l
def query(self, *ignored):
-
+
if self.start_name_re is None: raise KeyError, 'sequence-query'
query_string=self.query_string
while query_string and query_string[:1] in '?&':
@@ -140,7 +140,7 @@
while query_string[-1:] == '&':
query_string=query_string[:-1]
if query_string:
- query_string='&%s&' % query_string
+ query_string='&%s&' % query_string
reg=self.start_name_re
if type(reg)==type(re.compile(r"")):
@@ -160,9 +160,9 @@
query_string='?'+query_string[1:]
else: query_string='?'
self['sequence-query']=query_string
-
+
return query_string
-
+
statistic_names=(
'total', 'count', 'min', 'max', 'median', 'mean',
@@ -225,7 +225,7 @@
if count > 1:
sumsq=sumsq*n/(n-1)
data['variance-%s' % name]=sumsq
- data['standard-deviation-%s' % name]=sqrt(sumsq)
+ data['standard-deviation-%s' % name]=sqrt(sumsq)
else:
data['variance-%s' % name]=''
data['standard-deviation-%s' % name]=''
@@ -368,7 +368,7 @@
except: pass
if key=='sequence-query': return self.query()
-
+
raise KeyError, key
=== Zope/lib/python/DocumentTemplate/DT_Let.py 1.12 => 1.13 ===
--- Zope/lib/python/DocumentTemplate/DT_Let.py:1.12 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/DT_Let.py Wed Aug 14 18:29:52 2002
@@ -1,20 +1,20 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
''' The Let tag was contributed to Zope by and is copyright, 1999
Phillip J. Eby. Permission has been granted to release the Let tag
under the Zope Public License.
-
+
Let name=value...
@@ -38,7 +38,7 @@
Variables are processed in sequence, so later assignments can
reference and/or overwrite the results of previous assignments,
as desired.
-'''
+'''
from DT_Util import render_blocks, Eval, ParseError
from DT_Util import str # Probably needed due to hysterical pickles.
@@ -48,7 +48,7 @@
class Let:
blockContinuations=()
name='let'
-
+
def __init__(self, blocks):
tname, args, section = blocks[0]
self.__name__ = args
@@ -58,7 +58,7 @@
for i in range(len(args)):
name,expr = args[i]
if expr[:1]=='"' and expr[-1:]=='"' and len(expr) > 1:
- # expr shorthand
+ # expr shorthand
expr=expr[1:-1]
try: args[i] = name, Eval(expr).eval
except SyntaxError, v:
@@ -85,7 +85,7 @@
parmre=re.compile('([\000- ]*([^\000- ="]+)=([^\000- ="]+))'),
qparmre=re.compile('([\000- ]*([^\000- ="]+)="([^"]*)")'),
**parms):
-
+
result=result or []
mo = parmre.match(text)
@@ -108,4 +108,3 @@
text=text[l:].strip()
if text: return apply(parse_let_params,(text,result,tag),parms)
else: return result
-
=== Zope/lib/python/DocumentTemplate/DT_Raise.py 1.12 => 1.13 ===
--- Zope/lib/python/DocumentTemplate/DT_Raise.py:1.12 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/DT_Raise.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
'''Raising exceptions
@@ -22,7 +22,7 @@
<!--#/raise-->
<!--#/if-->
-'''
+'''
__rcs_id__='$Id$'
__version__='$Revision$'[11:-2]
@@ -43,9 +43,9 @@
def render(self,md):
expr=self.expr
if expr is None:
- t=self.__name__
- if t[-5:]=='Error' and __builtins__.has_key(t):
- t=__builtins__[t]
+ t=self.__name__
+ if t[-5:]=='Error' and __builtins__.has_key(t):
+ t=__builtins__[t]
else:
try: t=expr.eval(md)
except: t='Invalid Error Type Expression'
=== Zope/lib/python/DocumentTemplate/DT_Return.py 1.6 => 1.7 ===
--- Zope/lib/python/DocumentTemplate/DT_Return.py:1.6 Thu Feb 7 12:47:42 2002
+++ Zope/lib/python/DocumentTemplate/DT_Return.py Wed Aug 14 18:29:52 2002
@@ -1,21 +1,21 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__version__='$Revision$'[11:-2]
from DT_Util import parse_params, name_param, str
import sys
-class ReturnTag:
+class ReturnTag:
name='return'
expr=None
=== Zope/lib/python/DocumentTemplate/DT_String.py 1.50 => 1.51 ===
--- Zope/lib/python/DocumentTemplate/DT_String.py:1.50 Thu Aug 1 12:00:39 2002
+++ Zope/lib/python/DocumentTemplate/DT_String.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"$Id$"
@@ -36,7 +36,7 @@
%(name)s
%(in results)]
- """
+ """
isDocTemp=1
@@ -46,7 +46,7 @@
func_code.co_varnames='self','REQUEST'
func_code.co_argcount=2
func_code.__roles__=()
-
+
func_defaults__roles__=()
func_defaults=()
@@ -186,7 +186,7 @@
def skip_eol(self, text, start, eol=re.compile('[ \t]*\n')):
# if block open is followed by newline, then skip past newline
mo =eol.match(text,start)
- if mo is not None:
+ if mo is not None:
start = start + mo.end(0) - mo.start(0)
return start
@@ -210,7 +210,7 @@
try: tag, args, command, coname= self._parseTag(mo,scommand,sa)
except ParseError, m: self.parse_error(m[0],m[1], text, l)
-
+
if command:
start=l+len(tag)
if hasattr(command, 'blockContinuations'):
@@ -223,7 +223,7 @@
section._v_blocks=section.blocks=self.parse(text[:l],sstart)
section._v_cooked=None
blocks.append((tname,sargs,section))
-
+
start=self.skip_eol(text,l+len(tag))
if coname:
@@ -315,7 +315,7 @@
"""
if mapping is not None or vars:
self.initvars(mapping, vars)
- if source_string is not None:
+ if source_string is not None:
self.raw=source_string
self.cook()
@@ -371,13 +371,13 @@
containing values to be looked up. Values will be looked up
using getattr, so inheritence of values is supported. Note
that names beginning with '_' will not be looked up from the
- client.
+ client.
The optional argument, 'mapping' is used to specify a mapping
object containing values to be inserted.
Values to be inserted may also be specified using keyword
- arguments.
+ arguments.
Values will be inserted from one of several sources. The
sources, in the order in which they are consulted, are:
@@ -392,7 +392,7 @@
created, and
o The 'mapping' argument provided when the template was
- created.
+ created.
'''
# print '============================================================'
@@ -459,8 +459,8 @@
# otherwise its just a normal client object.
push(InstanceDict(client, md)) # Circ. Ref. 8-|
pushed=pushed+1
-
- if self._vars:
+
+ if self._vars:
push(self._vars)
pushed=pushed+1
@@ -498,7 +498,7 @@
class FileMixin:
# Mix-in class to abstract certain file-related attributes
edited_source=''
-
+
def __init__(self, file_name='', mapping=None, __name__='', **vars):
"""\
Create a document template based on a named file.
@@ -515,7 +515,7 @@
if self.edited_source: return self.edited_source
if not os.path.exists(self.raw):
print 'file not found: %s' % self.raw
-
+
if self.raw: return open(self.raw,'r').read()
return ''
=== Zope/lib/python/DocumentTemplate/DT_Try.py 1.12 => 1.13 ===
--- Zope/lib/python/DocumentTemplate/DT_Try.py:1.12 Thu Feb 7 12:47:42 2002
+++ Zope/lib/python/DocumentTemplate/DT_Try.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
import sys, traceback
@@ -19,41 +19,41 @@
class Try:
"""Zope DTML Exception handling
-
+
usage:
-
+
<!--#try-->
<!--#except SomeError AnotherError-->
<!--#except YetAnotherError-->
<!--#except-->
<!--#else-->
<!--#/try-->
-
+
or:
-
+
<!--#try-->
<!--#finally-->
<!--#/try-->
-
+
The DTML try tag functions quite like Python's try command.
-
+
The contents of the try tag are rendered. If an exception is raised,
then control switches to the except blocks. The first except block to
match the type of the error raised is rendered. If an except block has
no name then it matches all raised errors.
-
+
The try tag understands class-based exceptions, as well as string-based
exceptions. Note: the 'raise' tag raises string-based exceptions.
-
+
Inside the except blocks information about the error is available via
three variables.
-
+
'error_type' -- This variable is the name of the exception caught.
-
+
'error_value' -- This is the caught exception's value.
-
+
'error_tb' -- This is a traceback for the caught exception.
-
+
The optional else block is rendered when no exception occurs in the
try block. Exceptions in the else block are not handled by the preceding
except blocks.
@@ -78,10 +78,10 @@
lost.
Original version by Jordan B. Baker.
-
+
Try..finally and try..else implementation by Martijn Pieters.
"""
-
+
name = 'try'
blockContinuations = 'except', 'else', 'finally'
finallyBlock=None
@@ -158,7 +158,7 @@
errname = t.__name__
handler = self.find_handler(t)
-
+
if handler is None:
# we didn't find a handler, so reraise the error
raise
@@ -181,7 +181,7 @@
return result
else:
return result + render_blocks(self.elseBlock, md)
-
+
def render_try_finally(self, md):
result = ''
# first try to render the first block
@@ -202,13 +202,13 @@
return None
for e,h in self.handlers:
if e==exception.__name__ or e=='' or self.match_base(exception,e):
- return h
- return None
+ return h
+ return None
def match_base(self,exception,name):
for base in exception.__bases__:
if base.__name__==name or self.match_base(base,name):
return 1
return None
-
+
__call__ = render
=== Zope/lib/python/DocumentTemplate/DT_UI.py 1.11 => 1.12 ===
--- Zope/lib/python/DocumentTemplate/DT_UI.py:1.11 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/DT_UI.py Wed Aug 14 18:29:52 2002
@@ -1,18 +1,18 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Machinery to support through-the-web editing
-$Id$'''
+$Id$'''
__version__='$Revision$'[11:-2]
from DT_HTML import HTML
@@ -35,13 +35,13 @@
</HEAD>
<BODY bgcolor="#FFFFFF">
<!--#var document_template_edit_header-->
-
+
<FORM name="editform" ACTION="<!--#var URL1-->/manage_edit" METHOD="POST">
<!--#var document_template_form_header-->
Document template source:
<center>
<br>
- <TEXTAREA NAME="data:text" cols="<!--#var document_template_edit_width-->"
+ <TEXTAREA NAME="data:text" cols="<!--#var document_template_edit_width-->"
rows="20"><!--#var __str__--></TEXTAREA>
<br>
@@ -50,12 +50,12 @@
<INPUT NAME="dt_edit_name" TYPE="HIDDEN"
VALUE="<!--#var URL1-->">
<!--#if FactoryDefaultString-->
- <INPUT NAME=SUBMIT TYPE="SUBMIT"
+ <INPUT NAME=SUBMIT TYPE="SUBMIT"
VALUE="<!--#var FactoryDefaultString-->">
<!--#/if FactoryDefaultString-->
<INPUT NAME=SUBMIT TYPE="SUBMIT" VALUE="Cancel">
<!--#if HTTP_REFERER-->
- <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"
+ <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"
VALUE="<!--#var HTTP_REFERER-->">
<!--#else HTTP_REFERER-->
<!--#if URL1-->
@@ -65,10 +65,10 @@
<!--#/if HTTP_REFERER-->
</center>
</FORM>
-
+
<BR CLEAR="ALL">
<!--#var document_template_edit_footer-->
-
+
</BODY>
</HTML>""",)
=== Zope/lib/python/DocumentTemplate/DT_Util.py 1.87 => 1.88 ===
--- Zope/lib/python/DocumentTemplate/DT_Util.py:1.87 Thu Aug 1 12:00:39 2002
+++ Zope/lib/python/DocumentTemplate/DT_Util.py Wed Aug 14 18:29:52 2002
@@ -1,16 +1,16 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
-'''$Id$'''
+'''$Id$'''
__version__='$Revision$'[11:-2]
import re, os
@@ -234,7 +234,7 @@
# # Fix up something like: <!--#in expr="whatever" mapping-->
# params[params['']]=default_unnamed
# del params['']
-
+
if used(''):
v=params['']
@@ -257,7 +257,7 @@
'that doesn\'t support expr attributes.',
tag)
- else: # name shorthand
+ else: # name shorthand
if used(attr):
raise ParseError, ('Two %s values were given' % attr, tag)
if expr:
@@ -277,7 +277,7 @@
name=params['expr']
expr=Eval(name)
return name, expr
-
+
raise ParseError, ('No %s given' % attr, tag)
Expr_doc="""
@@ -308,20 +308,20 @@
mapping object. This variable can be useful for accessing objects
in a document template namespace that have names that are not legal
Python variable names::
-
+
<!--#var expr="_['sequence-number']*5"-->
-
+
This variable also has attributes that provide access to standard
utility objects. These attributes include:
-
+
- The objects: 'None', 'abs', 'chr', 'divmod', 'float', 'hash',
'hex', 'int', 'len', 'max', 'min', 'oct', 'ord', 'pow',
'round', and 'str' from the standard Python builtin module.
- Special security-aware versions of 'getattr' and 'hasattr',
-
+
- The Python 'string', 'math', and 'whrandom' modules, and
-
+
- A special function, 'test', that supports if-then expressions.
The 'test' function accepts any number of arguments. If the
first argument is true, then the second argument is returned,
@@ -329,10 +329,10 @@
argument is returned, and so on. If there is an odd number of
arguments, then the last argument is returned in the case that
none of the tested arguments is true, otherwise None is
- returned.
-
+ returned.
+
For example, to convert a value to lower case::
-
+
<!--#var expr="_.string.lower(title)"-->
"""
@@ -370,7 +370,7 @@
result=result or {}
- # HACK - we precalculate all matches. Maybe we don't need them
+ # HACK - we precalculate all matches. Maybe we don't need them
# all. This should be fixed for performance issues
mo_p = parmre.match(text)
@@ -393,7 +393,7 @@
if parms.has_key(name):
if parms[name] is None: raise ParseError, (
'Attribute %s requires a value' % name, tag)
-
+
result[name]=parms[name]
else: raise ParseError, (
'Invalid attribute name, "%s"' % name, tag)
@@ -410,7 +410,7 @@
else:
if not text or not text.strip(): return result
raise ParseError, ('invalid parameter: "%s"' % text, tag)
-
+
if not parms.has_key(name):
raise ParseError, (
'Invalid attribute name, "%s"' % name, tag)
@@ -420,7 +420,7 @@
if type(p) is not ListType or p:
raise ParseError, (
'Duplicate values for attribute "%s"' % name, tag)
-
+
result[name]=value
text=text[l:].strip()
=== Zope/lib/python/DocumentTemplate/DT_Var.py 1.56 => 1.57 ===
--- Zope/lib/python/DocumentTemplate/DT_Var.py:1.56 Wed Aug 14 12:34:20 2002
+++ Zope/lib/python/DocumentTemplate/DT_Var.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Variable insertion parameters
@@ -58,7 +58,7 @@
- Cannot be formatted with the specified format, and
- - Are either the special Python value 'None' or
+ - Are either the special Python value 'None' or
are false and yield an empty string when converted to
a string.
@@ -89,12 +89,12 @@
value after formatting has been applied. These parameters
are supplied without arguments.
- 'lower' -- cause all upper-case letters to be converted to lower case.
+ 'lower' -- cause all upper-case letters to be converted to lower case.
- 'upper' -- cause all upper-case letters to be converted to lower case.
+ 'upper' -- cause all upper-case letters to be converted to lower case.
'capitalize' -- cause the first character of the inserted value
- to be converted to upper case.
+ to be converted to upper case.
'spacify' -- cause underscores in the inserted value to be
converted to spaces.
@@ -140,7 +140,7 @@
truncation, the value given for the 'etc' attribute is added to
the string. If the 'etc' attribute is not provided, then '...'
is used. For example, if the value of spam is
- '"blah blah blah blah"', then the tag
+ '"blah blah blah blah"', then the tag
'<dtml-var spam size=10>' inserts '"blah blah ..."'.
@@ -148,7 +148,7 @@
A 'call' tag is provided for evaluating named objects or expressions
without rendering the result.
-
+
''' # '
__rcs_id__='$Id$'
@@ -163,7 +163,7 @@
from Acquisition import aq_base
from ZPublisher.TaintedString import TaintedString
-class Var:
+class Var:
name='var'
expr=None
@@ -177,7 +177,7 @@
url_unquote_plus=1,missing='',
newline_to_br=1, url=1)
self.args=args
-
+
self.modifiers=tuple(
map(lambda t: t[1],
filter(lambda m, args=args, used=args.has_key:
@@ -226,7 +226,7 @@
if have_arg('null') and not val and val != 0:
# check for null (false but not zero, including None, [], '')
return args['null']
-
+
# handle special formats defined using fmt= first
if have_arg('fmt'):
@@ -248,7 +248,7 @@
else:
val = special_formats[fmt](val, name, md)
elif fmt=='': val=''
- else:
+ else:
if isinstance(val, TaintedString):
val = TaintedString(fmt % val)
else:
@@ -317,12 +317,12 @@
if isinstance(val, TaintedString):
val = val.quoted()
-
+
return val
__call__=render
-class Call:
+class Call:
name='call'
expr=None
@@ -379,7 +379,7 @@
v=v[:l+1]+','+v[l+1:]
mo=thou(v)
return v+s
-
+
def whole_dollars_with_commas(v, name='(Unknown name)', md={}):
try: v= "$%d" % v
except: v=''
@@ -399,7 +399,7 @@
StructuredText=None
def structured_text(v, name='(Unknown name)', md={}):
global StructuredText
- if StructuredText is None:
+ if StructuredText is None:
from StructuredText.StructuredText import HTML
if isinstance(v,StringType): txt = v
@@ -408,11 +408,11 @@
txt = aq_base(v).read_raw()
else: txt = str(v)
-
- return HTML(txt,
+
+ return HTML(txt,
level=int(os.environ.get('STX_DEFAULT_LEVEL',3)),
header=0)
-
+
def sql_quote(v, name='(Unknown name)', md={}):
"""Quote single quotes in a string by doubling them.
@@ -457,15 +457,15 @@
The 'comment' tag can be used to simply include comments
in DTML source.
-
+
For example::
-
+
<!--#comment-->
-
+
This text is not rendered.
<!--#/comment-->
- '''
+ '''
name='comment'
blockContinuations=()
=== Zope/lib/python/DocumentTemplate/DT_With.py 1.14 => 1.15 ===
--- Zope/lib/python/DocumentTemplate/DT_With.py:1.14 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/DT_With.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
'''Nested namespace access
@@ -31,7 +31,7 @@
should be treated as mapping object, rather than as an object with
named attributes.
-'''
+'''
__rcs_id__='$Id$'
__version__='$Revision$'[11:-2]
@@ -43,7 +43,7 @@
name='with'
mapping=None
only=0
-
+
def __init__(self, blocks):
tname, args, section = blocks[0]
args=parse_params(args, name='', expr='', mapping=1, only=1)
=== Zope/lib/python/DocumentTemplate/DTtestExpr.py 1.7 => 1.8 ===
--- Zope/lib/python/DocumentTemplate/DTtestExpr.py:1.7 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/DTtestExpr.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''short description
@@ -47,7 +47,7 @@
print '-' * 77
print i, h(level=i)
print '-' * 77
-
+
if __name__ == "__main__":
try: command=sys.argv[1]
=== Zope/lib/python/DocumentTemplate/DocumentTemplate.py 1.13 => 1.14 ===
--- Zope/lib/python/DocumentTemplate/DocumentTemplate.py:1.13 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/DocumentTemplate.py Wed Aug 14 18:29:52 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
'''Document templates with fill-in fields
@@ -60,7 +60,7 @@
<!--#var total fmt=12.2f-->
is used to insert the variable 'total' with the C format
- '12.2f'.
+ '12.2f'.
Document templates support conditional and sequence insertion
=== Zope/lib/python/DocumentTemplate/VSEval.py 1.27 => 1.28 ===
--- Zope/lib/python/DocumentTemplate/VSEval.py:1.27 Fri Sep 14 10:31:56 2001
+++ Zope/lib/python/DocumentTemplate/VSEval.py Wed Aug 14 18:29:53 2002
@@ -7,4 +7,3 @@
for factor in factors:
r=r*factor
return r
-
=== Zope/lib/python/DocumentTemplate/__init__.py 1.16 => 1.17 ===
--- Zope/lib/python/DocumentTemplate/__init__.py:1.16 Wed Nov 28 10:50:55 2001
+++ Zope/lib/python/DocumentTemplate/__init__.py Wed Aug 14 18:29:53 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Package wrapper for Document Template
=== Zope/lib/python/DocumentTemplate/html_quote.py 1.2 => 1.3 ===
--- Zope/lib/python/DocumentTemplate/html_quote.py:1.2 Wed Mar 27 05:14:02 2002
+++ Zope/lib/python/DocumentTemplate/html_quote.py Wed Aug 14 18:29:53 2002
@@ -5,4 +5,3 @@
def html_quote(v, name='(Unknown name)', md={}):
return escape(ustr(v), 1)
-
=== Zope/lib/python/DocumentTemplate/pDocumentTemplate.py 1.35 => 1.36 ===
--- Zope/lib/python/DocumentTemplate/pDocumentTemplate.py:1.35 Wed Mar 27 05:14:02 2002
+++ Zope/lib/python/DocumentTemplate/pDocumentTemplate.py Wed Aug 14 18:29:53 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Python implementations of document template some features
@@ -69,7 +69,7 @@
cache=self.cache
if cache.has_key(key): return cache[key]
-
+
inst=self.self
if key[:1]=='_':
@@ -115,14 +115,14 @@
return kz
class DictInstance:
-
+
def __init__(self, mapping):
self.__d=mapping
def __getattr__(self, name):
try: return self.__d[name]
except KeyError: raise AttributeError, name
-
+
class TemplateDict:
level=0
@@ -152,10 +152,10 @@
return v
def __len__(self):
- total = 0
- for d in self.dicts.dicts:
- total = total + len(d)
- return total
+ total = 0
+ for d in self.dicts.dicts:
+ total = total + len(d)
+ return total
def has_key(self,key):
try:
@@ -163,7 +163,7 @@
except KeyError:
return 0
return 1
-
+
getitem=__getitem__
def __call__(self, *args, **kw):