1.1 --- a/macros/FormMessage.py Sat Jan 12 00:51:50 2013 +0100
1.2 +++ b/macros/FormMessage.py Sat Jan 19 22:50:29 2013 +0100
1.3 @@ -2,7 +2,7 @@
1.4 """
1.5 MoinMoin - FormMessage Macro
1.6
1.7 - @copyright: 2012 by Paul Boddie <paul@boddie.org.uk>
1.8 + @copyright: 2012, 2013 by Paul Boddie <paul@boddie.org.uk>
1.9 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.10 """
1.11
1.12 @@ -23,6 +23,7 @@
1.13 The following optional named arguments are also supported:
1.14
1.15 path=PATH The location of the field in the form section hierarchy
1.16 + fragment=NAME The name of the form region or fragment in the page
1.17 index=INDEX The index of the value to be displayed (instead of the first
1.18 value)
1.19 """
1.20 @@ -65,7 +66,14 @@
1.21 # Obtain any request parameters corresponding to the field.
1.22
1.23 form = get_form(request)
1.24 - value = form.get(ref, [""])[index and int(index) or 0]
1.25 + form_fragment = form.get("fragment", [None])[0]
1.26 +
1.27 + # Exclude values intended for other forms.
1.28 +
1.29 + if fragment and form_fragment != fragment or not fragment and form_fragment:
1.30 + value = ""
1.31 + else:
1.32 + value = form.get(ref, [""])[index and int(index) or 0]
1.33
1.34 # Render the message.
1.35