annotate data/plugin/macro/FormRadio.py @ 618:e6a6740166c8

FormCreate: pep8 cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 16:34:37 +0100
parents 07e8932e3594
children 819c4121f9a0
rev   line source
617
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - FormRadio Macro
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 @copyright: 2008 by Peter Bodi <petrdll@centrum.sk>
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 """
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 from FormField import FormField
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10
618
e6a6740166c8 FormCreate: pep8 cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
11
617
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 class FormRadio(FormField):
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 def __init(self, macro, args):
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 FormField.__init__(self, macro, args)
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 self.value = ""
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 self.checked = ""
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 self.size = ""
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 def parse_args(self):
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 FormField.parse_args(self)
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24 self.value = self._main[1]
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 def validate(self):
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 FormField.validate(self)
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 if not self.value:
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 self.msg = self._("Field value is not defined")
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 raise FormValidationError(self.msg)
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 def build(self):
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 FormField.build(self)
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 self._attribs["value"] = self.value
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 self._attribs["checked"] = "checked"
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 #self.output += self._build_input("hidden", "labels[]", {'value':self.label})
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 self.output += self._build_input("radio", self.label, self._attribs)
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38
618
e6a6740166c8 FormCreate: pep8 cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 617
diff changeset
39
617
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 def execute(macro, args):
07e8932e3594 add code from MacroMarket/FormCreate (form_create-1.7.tgz) - outdated code for moin 1.7/1.8
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 return FormRadio(macro, args).render()