]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
fix skipping of class definitions without parens
authorPhilip Jenvey <pjenvey@underboss.org>
Wed, 18 Jul 2007 20:49:12 +0000 (20:49 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Wed, 18 Jul 2007 20:49:12 +0000 (20:49 +0000)
fixes #55

babel/messages/extract.py
babel/messages/tests/extract.py

index d7d54e7467611b2c76c2780bec04099150cfcaff..fd4a7e895f5894bc2f68829fdce03c404a4fde37 100644 (file)
@@ -295,6 +295,10 @@ def extract_python(fileobj, keywords, comment_tags, options):
             if funcname:
                 message_lineno = lineno
                 call_stack += 1
+        elif in_def and tok == OP and value == ':':
+            # End of a class definition without parens
+            in_def = False
+            continue
         elif call_stack == -1 and tok == COMMENT:
             # Strip the comment token from the line
             value = value.decode(encoding)[1:].strip()
index bfcc4fdf4ac35fb67affcad82d031e4f7199b814..5ee64b445a50f1c016284862ec32b8600e052bb6 100644 (file)
@@ -70,12 +70,15 @@ def render_body(context,x,y=_('Page arg 1'),z=_('Page arg 2'),**pageargs):
     pass
 def ngettext(y='arg 1',z='arg 2',**pageargs):
     pass
+class Meta:
+    verbose_name = _('log entry')
 """)
         messages = list(extract.extract_python(buf,
                                                extract.DEFAULT_KEYWORDS.keys(),
                                                [], {}))
         self.assertEqual([(3, '_', u'Page arg 1', []),
-                          (3, '_', u'Page arg 2', [])],
+                          (3, '_', u'Page arg 2', []),
+                          (8, '_', u'log entry', [])],
                          messages)
 
     def test_multiline(self):