src/pyams_utils/tales.py
changeset 219 758f286d76af
parent 218 9bf1c695938e
child 292 b338586588ad
equal deleted inserted replaced
218:9bf1c695938e 219:758f286d76af
    38                              target=target,
    38                              target=target,
    39                              transform=self.transform)
    39                              transform=self.transform)
    40         return assignment + transform
    40         return assignment + transform
    41 
    41 
    42 
    42 
    43 FUNCTION_EXPRESSION = re.compile('(.+)\((.+)\)')
    43 FUNCTION_EXPRESSION = re.compile('(.+)\((.+)\)', re.MULTILINE | re.DOTALL)
    44 ARGUMENTS_EXPRESSION = re.compile('[^(,)]+')
    44 ARGUMENTS_EXPRESSION = re.compile('[^(,)]+')
    45 
    45 
    46 
    46 
    47 def render_extension(econtext, name):
    47 def render_extension(econtext, name):
    48     """TALES extension renderer
    48     """TALES extension renderer
    61             # may be a quoted string...
    61             # may be a quoted string...
    62             return arg[1:-1]
    62             return arg[1:-1]
    63         if '=' in arg:
    63         if '=' in arg:
    64             key, value = arg.split('=', 1)
    64             key, value = arg.split('=', 1)
    65             value = get_value(econtext, value)
    65             value = get_value(econtext, value)
    66             return {key: value}
    66             return {key.strip(): value}
    67         try:
    67         try:
    68             arg = int(arg)  # check integer value
    68             arg = int(arg)  # check integer value
    69         except ValueError:
    69         except ValueError:
    70             args = arg.split('.')
    70             args = arg.split('.')
    71             result = econtext.get(args.pop(0))
    71             result = econtext.get(args.pop(0))