# HG changeset patch # User jruigrok # Date 1270974056 0 # Node ID cb938a3bd4baa56c4c75b18b090bda56e2fd9546 # Parent ef7aedfe329833f488932f395130b4483fc4b688 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. ........ diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/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 diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py --- a/babel/messages/catalog.py +++ b/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 diff --git a/babel/messages/tests/catalog.py b/babel/messages/tests/catalog.py --- a/babel/messages/tests/catalog.py +++ b/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()