Hi,

 the following code raises error as per subject:

   import re
   from django.db import models
   from django.newforms.models import form_for_model
   from django.utils.translation import gettext_lazy as _


   class Abc(models.Model):
       choice = models.CharField(maxlength=10, help_text='xyz')
       class Meta: app_label = 'xxx'

   form = form_for_model(Abc)()
   field = form.fields['choice']
   html = u'title="%s"' % re.sub('"', r'\"', _(field.help_text)  )

Traceback (most recent call last):
  File "<stdin>", line 27, in ?
  File "/usr/lib/python2.4/sre.py", line 142, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer

The problem is that _(field.help_text) is an instance of
django.utils.functional.__proxy__ and that is not accepted by
re.sub.

I'm also pretty sure that this same peace of code was working up to
some
days ago when I updated  to svn rel 5134.

Any hint on how to solve this probelm?

Thanks in advance
sandro
*:-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to