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 1069 2008-11-13 21:55:43Z stefan $

Classes [hide private]
  Eval
Functions [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=[]) 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)
Create a tuple consisting of a single instance whose attributes are provided as keyword arguments.
source code
 
render(self, v)
Render an object in the way done by the 'name' attribute
source code
 
name_param(params, tag='', expr=0, attr='name', default_unnamed=1) source code
 
parse_params(text, result=None, tag='', unparmre=re.compile(r'([\x00- ]*([^\x00- ="]+))'), qunparmre=re.compile(r'([\x00- ]*("[^"]*"))'), parmre=re.compile(r'([\x00- ]*([^\x00- ="]+)=([^\x00- ="]+))'), qparmre=re.compile(r'([\x00- ]*([^\x00- ="]+)="([^"]*)")'), **parms)
Parse tag parameters
source code
Variables [hide private]
  ParseError = 'Document Template Parse Error'
  ValidationError = 'Unauthorized'
  _marker = []
  d = {'None': None, '__call__': <function __call__ at 0x166a1b8...
  expr_globals = {'__builtins__': {}, '__guarded_getattr__': <fu...
  Expr_doc = '\n\n\nPython expression support\n\n Several docum...
  __package__ = 'qm.external.DocumentTemplate'
  name = 'str'
Function Details [hide private]

parse_params(text, result=None, tag='', unparmre=re.compile(r'([\x00- ]*([^\x00- ="]+))'), qunparmre=re.compile(r'([\x00- ]*("[^"]*"))'), parmre=re.compile(r'([\x00- ]*([^\x00- ="]+)=([^\x00- ="]+))'), qparmre=re.compile(r'([\x00- ]*([^\x00- ="]+)="([^"]*)")'), **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]

d

Value:
TemplateDict.__dict__

expr_globals

Value:
{'__builtins__': {}, '__guarded_mul__': VSEval.careful_mul, '__guarded\
_getattr__': careful_getattr, '__guarded_getitem__': careful_getitem, \
'__guarded_getslice__': careful_getslice,}

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
...