Mercurial > babel > old > mirror
changeset 324:2e055bcabe2b
fix invalid message extraction methods causing:
UnboundLocalError: local variable 'func' referenced before assignment
thanks cramm
author | pjenvey |
---|---|
date | Mon, 18 Feb 2008 18:09:30 +0000 |
parents | f2eeddb5ff5b |
children | 9fe7e31f857d |
files | ChangeLog babel/messages/extract.py babel/messages/tests/extract.py |
diffstat | 3 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Version 0.9.3 +http://svn.edgewall.org/repos/babel/tags/0.9.3/ +(?, from branches/stable/0.9.x) + +* Fixed invalid message extraction methods causing an UnboundLocalError. + + Version 0.9.2 http://svn.edgewall.org/repos/babel/tags/0.9.2/ (Feb 4 2007, from branches/stable/0.9.x)
--- a/babel/messages/extract.py +++ b/babel/messages/extract.py @@ -219,6 +219,7 @@ :rtype: `list` :raise ValueError: if the extraction method is not registered """ + func = None if ':' in method: module, clsname = method.split(':', 1) func = getattr(__import__(module, {}, {}, [clsname]), clsname)
--- a/babel/messages/tests/extract.py +++ b/babel/messages/tests/extract.py @@ -325,6 +325,10 @@ (8, u'Rabbit', []), (10, (u'Page', u'Pages'), [])], messages) + def test_invalid_extract_method(self): + buf = StringIO('') + self.assertRaises(ValueError, list, extract.extract('spam', buf)) + def test_different_signatures(self): buf = StringIO(""" foo = _('foo', 'bar')