Changeset 3444:a683a6470ffb in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/04/08 14:18:52 (11 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Change ul4c._repr() to work recursivly for lists and dicts.

This can now lead to endless recursion, as no code in the template can
generate a recursive list (Although this *is* possible via bytecodes.)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/ul4c.py

    r3443 r3444  
    21422142    elif isinstance(obj, datetime.datetime): 
    21432143        return unicode(obj.isoformat()) 
     2144    elif isinstance(obj, list): 
     2145        return u"[%s]" % u", ".join(_repr(item) for item in obj) 
     2146    elif isinstance(obj, dict): 
     2147        return u"{%s}" % u", ".join(u"%s: %s" % (_repr(key), _repr(value)) for (key, value) in obj.iteritems()) 
    21442148    else: 
    21452149        return unicode(repr(obj))