1.1 --- a/macros/FormMessage.py Mon Dec 10 00:13:17 2012 +0100
1.2 +++ b/macros/FormMessage.py Wed Dec 12 00:37:44 2012 +0100
1.3 @@ -23,6 +23,8 @@
1.4 The following optional named arguments are also supported:
1.5
1.6 path=PATH The location of the field in the form section hierarchy
1.7 + index=INDEX The index of the value to be displayed (instead of the first
1.8 + value)
1.9 """
1.10
1.11 request = macro.request
1.12 @@ -38,6 +40,7 @@
1.13
1.14 name = None
1.15 path = None
1.16 + index = None
1.17
1.18 for arg in parsed_args:
1.19 if arg.startswith("name="):
1.20 @@ -46,6 +49,9 @@
1.21 elif arg.startswith("path="):
1.22 path = arg[5:]
1.23
1.24 + elif arg.startswith("index="):
1.25 + index = arg[6:]
1.26 +
1.27 elif name is None:
1.28 name = arg
1.29
1.30 @@ -59,7 +65,7 @@
1.31 # Obtain any request parameters corresponding to the field.
1.32
1.33 form = get_form(request)
1.34 - value = form.get(ref, [""])[0]
1.35 + value = form.get(ref, [""])[index and int(index) or 0]
1.36
1.37 # Render the message.
1.38