You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the current extract function only allowed arguments to go on a single
line I wrote this to allow multiline arguments.
def extract_multiline_nodelist_options(nodelist, context=None):
"""
Returns a dict containing the key=value options listed within the nodelist.
The value can be a python dict, list, tuple, or number/string literal.
"""
ret={}
if context:
rendered = nodelist.render(context)
else:
rendered = nodelist.render({})
if rendered.find("=") > 0:
opts = rendered.split("\n")
for i in range(len(opts)):
while i+1 < len(opts) and opts[i+1].find("=") == -1:
opts[i] += opts.pop(i+1)
for key, val in [opt.strip().split("=") for opt in opts if opt != ""]:
ret[key.strip()]=eval(val.strip())
return ret
Original link: http://code.google.com/p/dojango/issues/detail?id=24
The text was updated successfully, but these errors were encountered:
Original link: http://code.google.com/p/dojango/issues/detail?id=24
The text was updated successfully, but these errors were encountered: