changeset 474:c40f442c22b7 stable

Merged revisions 460-461 via svnmerge from http://svn.edgewall.org/repos/babel/trunk ........ r460 | palgarvio | 2008-12-16 00:47:54 +0100 (di, 16 dec 2008) | 2 lines Make the `POT-Creation-Date` of the catalog being updated equal to `POT-Creation-Date` of the template used to update. Fixes #148. ........ r461 | palgarvio | 2008-12-16 14:35:23 +0100 (di, 16 dec 2008) | 2 lines Testcase for fix of #148. ........
author jruigrok
date Sun, 11 Apr 2010 08:20:56 +0000
parents 95b3063ef532
children eab2fceb8ab0
files 0.9.x/ChangeLog 0.9.x/babel/messages/catalog.py 0.9.x/babel/messages/tests/catalog.py
diffstat 3 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/0.9.x/ChangeLog
+++ b/0.9.x/ChangeLog
@@ -6,6 +6,8 @@
  * Make the CLDR import script work with Python 2.7.
  * Fix various typos.
  * Sort output of list-locales.
+ * Make the POT-Creation-Date of the catalog being updated equal to
+   POT-Creation-Date of the template used to update (ticket #148).
 
 
 Version 0.9.5
--- a/0.9.x/babel/messages/catalog.py
+++ b/0.9.x/babel/messages/catalog.py
@@ -710,6 +710,9 @@
         for msgid in remaining:
             if no_fuzzy_matching or msgid not in fuzzy_matches:
                 self.obsolete[msgid] = remaining[msgid]
+        # Make updated catalog's POT-Creation-Date equal to the template
+        # used to update the catalog
+        self.creation_date = template.creation_date
 
     def _key_for(self, id):
         """The key for a message is just the singular ID even for pluralizable
--- a/0.9.x/babel/messages/tests/catalog.py
+++ b/0.9.x/babel/messages/tests/catalog.py
@@ -12,6 +12,7 @@
 # history and logs, available at http://babel.edgewall.org/log/.
 
 import copy
+import datetime
 import doctest
 import unittest
 
@@ -208,6 +209,20 @@
 
         self.assertEqual(None, cat2['foo'].string)
         self.assertEqual(False, cat2['foo'].fuzzy)
+        
+    def test_update_po_updates_pot_creation_date(self):
+        template = catalog.Catalog()
+        localized_catalog = copy.deepcopy(template)
+        localized_catalog.locale = 'de_DE'
+        self.assertNotEqual(template.mime_headers,
+                            localized_catalog.mime_headers)
+        self.assertEqual(template.creation_date,
+                         localized_catalog.creation_date)
+        template.creation_date = datetime.datetime.now() - \
+                                                datetime.timedelta(minutes=5)
+        localized_catalog.update(template)
+        self.assertEqual(template.creation_date,
+                         localized_catalog.creation_date)
 
 def suite():
     suite = unittest.TestSuite()
Copyright (C) 2012-2017 Edgewall Software