changeset 188:96f858026208 trunk

Fix adding new messages in catalog update.
author cmlenz
date Fri, 29 Jun 2007 13:47:10 +0000
parents 5f1fbe5cf75a
children cdb266cd9a19
files babel/messages/catalog.py
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/babel/messages/catalog.py
+++ b/babel/messages/catalog.py
@@ -490,6 +490,7 @@
         
         >>> from babel.messages import Catalog
         >>> template = Catalog()
+        >>> template.add('green', locations=[('main.py', 99)])
         >>> template.add('blue', locations=[('main.py', 100)])
         >>> template.add(('salad', 'salads'), locations=[('util.py', 42)])
         >>> catalog = Catalog(locale='de_DE')
@@ -500,18 +501,23 @@
         
         >>> catalog.update(template)
         >>> len(catalog)
-        2
+        3
         
-        >>> msg1 = catalog['blue']
+        >>> msg1 = catalog['green']
         >>> msg1.string
+        >>> msg1.locations
+        [('main.py', 99)]
+        
+        >>> msg2 = catalog['blue']
+        >>> msg2.string
         u'blau'
-        >>> msg1.locations
+        >>> msg2.locations
         [('main.py', 100)]
         
-        >>> msg2 = catalog['salad']
-        >>> msg2.string
+        >>> msg3 = catalog['salad']
+        >>> msg3.string
         (u'Salat', u'Salate')
-        >>> msg2.locations
+        >>> msg3.locations
         [('util.py', 42)]
         
         Messages that are in the catalog but not in the template are removed
@@ -548,7 +554,7 @@
                             message.string = oldmsg.string
                             message.flags |= oldmsg.flags | set([u'fuzzy'])
                             self[message.id] = message
-                        continue
+                            continue
 
                     self[message.id] = message
 
Copyright (C) 2012-2017 Edgewall Software