Mercurial > babel > old > mirror
comparison babel/messages/catalog.py @ 229:85340bec3a97
Fix tests broken by [233], and add new tests.
author | cmlenz |
---|---|
date | Fri, 20 Jul 2007 16:20:43 +0000 |
parents | 629357c88d59 |
children | aaf36f409166 |
comparison
equal
deleted
inserted
replaced
228:629357c88d59 | 229:85340bec3a97 |
---|---|
26 | 26 |
27 from babel import __version__ as VERSION | 27 from babel import __version__ as VERSION |
28 from babel.core import Locale | 28 from babel.core import Locale |
29 from babel.dates import format_datetime | 29 from babel.dates import format_datetime |
30 from babel.messages.plurals import PLURALS | 30 from babel.messages.plurals import PLURALS |
31 from babel.util import odict, LOCALTZ, UTC, FixedOffsetTimezone | 31 from babel.util import odict, distinct, LOCALTZ, UTC, FixedOffsetTimezone |
32 | 32 |
33 __all__ = ['Message', 'Catalog', 'TranslationError'] | 33 __all__ = ['Message', 'Catalog', 'TranslationError'] |
34 __docformat__ = 'restructuredtext en' | 34 __docformat__ = 'restructuredtext en' |
35 | 35 |
36 PYTHON_FORMAT = re.compile(r'\%(\([\w]+\))?([-#0\ +])?(\*|[\d]+)?(\.(\*|[\d]+))?([hlL])?[diouxXeEfFgGcrs]') | 36 PYTHON_FORMAT = re.compile(r'\%(\([\w]+\))?([-#0\ +])?(\*|[\d]+)?(\.(\*|[\d]+))?([hlL])?[diouxXeEfFgGcrs]') |
64 self.flags = set(flags) | 64 self.flags = set(flags) |
65 if id and self.python_format: | 65 if id and self.python_format: |
66 self.flags.add('python-format') | 66 self.flags.add('python-format') |
67 else: | 67 else: |
68 self.flags.discard('python-format') | 68 self.flags.discard('python-format') |
69 self.auto_comments = list(set(auto_comments)) | 69 self.auto_comments = list(distinct(auto_comments)) |
70 self.user_comments = list(set(user_comments)) | 70 self.user_comments = list(distinct(user_comments)) |
71 if isinstance(previous_id, basestring): | 71 if isinstance(previous_id, basestring): |
72 self.previous_id = [previous_id] | 72 self.previous_id = [previous_id] |
73 else: | 73 else: |
74 self.previous_id = list(previous_id) | 74 self.previous_id = list(previous_id) |
75 self.lineno = lineno | 75 self.lineno = lineno |