Skip to content
Browse files

Thanks to bmihelac for the fix, this fixes issue #GH-90

  • Loading branch information...
1 parent 0f1ba29 commit 2f57d6cc6564c24ab02b4385ba2f7af5d669a75e @maraujop maraujop committed Sep 17, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 uni_form/
6 uni_form/
@@ -166,7 +166,7 @@ class Fieldset(object):
def __init__(self, legend, *fields, **kwargs):
self.fields = list(fields)
- self.legend = Template(legend)
+ self.legend = unicode(legend)
bmihelac added a note Sep 17, 2011

If we use unicodehere, lazy translation string would be translated when this fieldset is created and not when it is rendered.

Isn't it maybe too early?

maraujop added a note Sep 17, 2011

Good point, I've tried dev on a project full of i18n and it works this way. So I guess it's late enough this way and probably this unloads some work when rendering, right?

bmihelac added a note Sep 17, 2011

As long as helper is defined as a property of a form, it is initiated every time it is called.

I do not have any helper defined outside of a form for now but can imagine it happen for some reason.

maraujop added a note Sep 17, 2011

Most of my helpers are static variables of the form. So they behave like a Singleton, they get created first time a form is instantiated and then reused. This is the way that best performs if you don't manipulate helpers in your views. All this has been updated in 0.9.0 docs. So I guess leaving it like this is ok. Thanks for paying so much attention.

bmihelac added a note Sep 17, 2011

ok, i will check it later on 0.9.0


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
self.css_class = kwargs.get('css_class', '')
self.css_id = kwargs.get('css_id', None)
# Overrides class variable with an instance level variable
@@ -177,7 +177,9 @@ def render(self, form, form_style, context):
for field in self.fields:
fields += render_field(field, form, form_style, context)
- legend = u'%s' % self.legend.render(context)
+ legend = ''
+ if self.legend:
+ legend = u'%s' % Template(self.legend).render(context)
return render_to_string(self.template, Context({'fieldset': self, 'legend': legend, 'fields': fields, 'form_style': form_style}))

0 comments on commit 2f57d6c

Please sign in to comment.
Something went wrong with that request. Please try again.