Package qm :: Package external :: Package DocumentTemplate :: Module DT_Util
[hide private]
[frames] | no frames]

Module DT_Util
source code

DTML Utilities

$Id: DT_Util.py 1007 2007-02-10 01:07:28Z stefan $

Classes [hide private]
str str(object) -> string
Eval  
ListType list() -> new list list(sequence) -> new list initialized from sequence's items

Functions [hide private]
  html_quote(v, name='(Unknown name)', md={}, character_entities=((('&'),'&amp;'), (('<'),'&lt;'), (('>'),'&gt;'), (('"'),'&quot;')))
  int_param(params, md, name, default=0, st=<type 'str'>)
  careful_getattr(md, inst, name, default=_marker)
  careful_hasattr(md, inst, name)
  careful_getitem(md, mapping, key)
  careful_getslice(md, seq, *indexes)
  careful_range(md, iFirst, *args)
  careful_pow(self, x, y, z)
  test(self, *args)
  obsolete_attr(self, inst, name, md)
  namespace(self, **kw)
Create a tuple consisting of a single instance whose attributes are provided as keyword arguments.
  render(self, v)
Render an object in the way done by the 'name' attribute
  reorder(self, s, with=None, without=())
  name_param(params, tag='', expr=0, attr='name', default_unnamed=1)
  parse_params(text, result=None, tag='', unparmre=re.compile('([\000- ]*([^\000- ="]+))'), qunparmre=re.compile('([\000- ]*("[^"]*"))'), parmre=re.compile('([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile('([\000- ]*([^\000- ="]+)="([^"]*)")'), **parms)
Parse tag parameters

Variables [hide private]
ParseError  
ValidationError  
_marker  
d  
expr_globals  
Expr_doc  
name  

Function Details [hide private]

html_quote(v, name='(Unknown name)', md={}, character_entities=((('&'),'&amp;'), (('<'),'&lt;'), (('>'),'&gt;'), (('"'),'&quot;')))

source code 

int_param(params, md, name, default=0, st=<type 'str'>)

source code 

careful_getattr(md, inst, name, default=_marker)

source code 

careful_hasattr(md, inst, name)

source code 

careful_getitem(md, mapping, key)

source code 

careful_getslice(md, seq, *indexes)

source code 

careful_range(md, iFirst, *args)

source code 

careful_pow(self, x, y, z)

source code 

test(self, *args)

source code 

obsolete_attr(self, inst, name, md)

source code 

namespace(self, **kw)

source code 
Create a tuple consisting of a single instance whose attributes are provided as keyword arguments.

render(self, v)

source code 
Render an object in the way done by the 'name' attribute

reorder(self, s, with=None, without=())

source code 

name_param(params, tag='', expr=0, attr='name', default_unnamed=1)

source code 

parse_params(text, result=None, tag='', unparmre=re.compile('([\000- ]*([^\000- ="]+))'), qunparmre=re.compile('([\000- ]*("[^"]*"))'), parmre=re.compile('([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile('([\000- ]*([^\000- ="]+)="([^"]*)")'), **parms)

source code 

Parse tag parameters

The format of tag parameters consists of 1 or more parameter specifications separated by whitespace. Each specification consists of an unnamed and unquoted value, a valueless name, or a name-value pair. A name-value pair consists of a name and a quoted or unquoted value separated by an '='.

The input parameter, text, gives the text to be parsed. The keyword parameters give valid parameter names and default values.

If a specification is not a name-value pair and it is not the first specification and it is a valid parameter name, then it is treated as a name-value pair with a value as given in the keyword argument. Otherwise, if it is not a name-value pair, it is treated as an unnamed value.

The data are parsed into a dictionary mapping names to values. Unnamed values are mapped from the name '""'. Only one value may be given for a name and there may be only one unnamed value.

Variables Details [hide private]

ParseError

Value:
'Document Template Parse Error'                                        
      

ValidationError

Value:
'Unauthorized'                                                         
      

_marker

Value:
[]                                                                     
      

d

Value:
{'DateTime': <class DateTime.DateTime.DateTime at 0xb7a3a65c>,
 'None': None,
 '__call__': <function __call__ at 0xb7aa91ec>,
 '__doc__': None,
 '__getitem__': <function __getitem__ at 0xb7aa917c>,
 '__init__': <function __init__ at 0xb7aa9144>,
 '__module__': 'qm.external.DocumentTemplate.pDocumentTemplate',
 '_pop': <function _pop at 0xb7aa90d4>,
...                                                                    
      

expr_globals

Value:
{'__builtins__': {},
 '__guarded_getattr__': <function careful_getattr at 0xb7a99aac>,
 '__guarded_getitem__': <function careful_getitem at 0xb7a99b1c>,
 '__guarded_getslice__': <function careful_getslice at 0xb7a99b54>,
 '__guarded_mul__': <function careful_mul at 0xb7a998ec>}              
      

Expr_doc

Value:
'''


Python expression support

  Several document template tags, including \'var\', \'in\', \'if\', \\
'else\',
  and \'elif\' provide support for using Python expressions via an
...                                                                    
      

name

Value:
'str'