319 def formatdict(data, key, value, fmt, sep): |
319 def formatdict(data, key, value, fmt, sep): |
320 '''build object that can be evaluated as either plain string or dict''' |
320 '''build object that can be evaluated as either plain string or dict''' |
321 data = util.sortdict(_iteritems(data)) |
321 data = util.sortdict(_iteritems(data)) |
322 def f(): |
322 def f(): |
323 yield _plainconverter.formatdict(data, key, value, fmt, sep) |
323 yield _plainconverter.formatdict(data, key, value, fmt, sep) |
324 return templatekw._hybrid(f(), data, lambda k: {key: k, value: data[k]}, |
324 return templatekw.hybriddict(data, key=key, value=value, fmt=fmt, |
325 lambda d: fmt % (d[key], d[value])) |
325 gen=f()) |
326 @staticmethod |
326 @staticmethod |
327 def formatlist(data, name, fmt, sep): |
327 def formatlist(data, name, fmt, sep): |
328 '''build object that can be evaluated as either plain string or list''' |
328 '''build object that can be evaluated as either plain string or list''' |
329 data = list(data) |
329 data = list(data) |
330 def f(): |
330 def f(): |