#10167: RegexField: error_message is evaluated instead of tested for None
-------------------+--------------------------------------------------------
 Reporter:  dmach  |       Owner:  nobody    
   Status:  new    |   Milestone:            
Component:  Forms  |     Version:  SVN       
 Keywords:         |       Stage:  Unreviewed
Has_patch:  1      |  
-------------------+--------------------------------------------------------
 In RegexField, the error_message argument is evaluated instead of tested
 for None.

 If USE_I18N is enabled and RegexField(error_message=_(...)) appears in any
 app's _ _init_ _.py, it leads to a traceback.

 (project: myproj, application: myapp)[[BR]]
 $ python manage.py syncdb
 {{{
 ...
   File "/usr/lib/python2.4/site-packages/django/forms/fields.py", line
 400, in __init__
     if error_message:
   File "/usr/lib/python2.4/site-packages/django/utils/functional.py", line
 188, in __wrapper__
     res = self.__func(*self.__args, **self.__kw)
   File "/usr/lib/python2.4/site-
 packages/django/utils/translation/__init__.py", line 62, in ugettext
     return real_ugettext(message)
   File "/usr/lib/python2.4/site-
 packages/django/utils/translation/trans_real.py", line 290, in ugettext
     return do_translate(message, 'ugettext')
   File "/usr/lib/python2.4/site-
 packages/django/utils/translation/trans_real.py", line 280, in
 do_translate
     _default = translation(settings.LANGUAGE_CODE)
   File "/usr/lib/python2.4/site-
 packages/django/utils/translation/trans_real.py", line 198, in translation
     default_translation = _fetch(settings.LANGUAGE_CODE)
   File "/usr/lib/python2.4/site-
 packages/django/utils/translation/trans_real.py", line 181, in _fetch
     app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]),
 appname[p+1:])
 AttributeError: 'module' object has no attribute 'myapp'
 }}}

 Attached patch solves the problem.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10167>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to