##// END OF EJS Templates
forms: added RcForm with custom error reporting widget.
marcink -
r1715:805107e8 default
parent child Browse files
Show More
@@ -24,6 +24,9 b' deform - later can be replaced with some'
24 24 """
25 25
26 26 from rhodecode.translation import _
27 from rhodecode.translation import TranslationString
28
29 from mako.template import Template
27 30 from deform import Button, Form, widget, ValidationFailure
28 31
29 32
@@ -31,3 +34,16 b' class buttons:'
31 34 save = Button(name='Save', type='submit')
32 35 reset = Button(name=_('Reset'), type='reset')
33 36 delete = Button(name=_('Delete'), type='submit')
37
38
39 class RcForm(Form):
40 def render_error(self, request, field):
41 html = ''
42 if field.error:
43 for err in field.error.messages():
44 if isinstance(err, TranslationString):
45 err = request.translate(err)
46 html = Template(
47 '<span class="error-message">${err}</span>').render(err=err)
48
49 return html
General Comments 0
You need to be logged in to leave comments. Login now