Mercurial > babel > old > babel-test
annotate babel/util.py @ 134:60565dc8495d
More fixes for Windows compatibility:
* normalize path segment separator to "/"
* use `dates.format_date` also to set the expected date-strings in the frontend tests.
author | cmlenz |
---|---|
date | Tue, 19 Jun 2007 12:13:46 +0000 |
parents | d4bdf67c7734 |
children | f2c78a271159 06af84d082a3 |
rev | line source |
---|---|
1 | 1 # -*- coding: utf-8 -*- |
2 # | |
3 # Copyright (C) 2007 Edgewall Software | |
4 # All rights reserved. | |
5 # | |
6 # This software is licensed as described in the file COPYING, which | |
7 # you should have received as part of this distribution. The terms | |
8 # are also available at http://babel.edgewall.org/wiki/License. | |
9 # | |
10 # This software consists of voluntary contributions made by many | |
11 # individuals. For the exact contribution history, see the revision | |
12 # history and logs, available at http://babel.edgewall.org/log/. | |
13 | |
14 """Various utility classes and functions.""" | |
15 | |
30 | 16 from datetime import timedelta, tzinfo |
1 | 17 import os |
18 import re | |
95
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
19 import time |
1 | 20 |
97 | 21 __all__ = ['pathmatch', 'relpath', 'UTC', 'LOCALTZ'] |
1 | 22 __docformat__ = 'restructuredtext en' |
23 | |
44 | 24 def pathmatch(pattern, filename): |
25 """Extended pathname pattern matching. | |
1 | 26 |
44 | 27 This function is similar to what is provided by the ``fnmatch`` module in |
28 the Python standard library, but: | |
29 | |
30 * can match complete (relative or absolute) path names, and not just file | |
31 names, and | |
32 * also supports a convenience pattern ("**") to match files at any | |
33 directory level. | |
34 | |
35 Examples: | |
36 | |
37 >>> pathmatch('**.py', 'bar.py') | |
38 True | |
39 >>> pathmatch('**.py', 'foo/bar/baz.py') | |
40 True | |
41 >>> pathmatch('**.py', 'templates/index.html') | |
42 False | |
47
76381d4b3635
Support passing extraction method mapping and options from the frontends (see #4). No distutils/setuptools keyword supported yet, but the rest seems to be working okay.
cmlenz
parents:
44
diff
changeset
|
43 |
44 | 44 >>> pathmatch('**/templates/*.html', 'templates/index.html') |
45 True | |
46 >>> pathmatch('**/templates/*.html', 'templates/foo/bar.html') | |
47 False | |
1 | 48 |
49 :param pattern: the glob pattern | |
44 | 50 :param filename: the path name of the file to match against |
51 :return: `True` if the path name matches the pattern, `False` otherwise | |
52 :rtype: `bool` | |
1 | 53 """ |
54 symbols = { | |
55 '?': '[^/]', | |
56 '?/': '[^/]/', | |
57 '*': '[^/]+', | |
58 '*/': '[^/]+/', | |
59 '**/': '(?:.+/)*?', | |
44 | 60 '**': '(?:.+/)*?[^/]+', |
1 | 61 } |
62 buf = [] | |
63 for idx, part in enumerate(re.split('([?*]+/?)', pattern)): | |
64 if idx % 2: | |
65 buf.append(symbols[part]) | |
66 elif part: | |
67 buf.append(re.escape(part)) | |
134 | 68 match = re.match(''.join(buf) + '$', filename.replace(os.sep, '/')) |
69 return match is not None | |
1 | 70 |
29 | 71 |
56
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
72 class odict(dict): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
73 """Ordered dict implementation. |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
74 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
75 :see: `http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747` |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
76 """ |
62
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
60
diff
changeset
|
77 def __init__(self, data=None): |
84d400066b71
The order of extraction methods is now preserved (see #10).
cmlenz
parents:
60
diff
changeset
|
78 dict.__init__(self, data or {}) |
56
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
79 self._keys = [] |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
80 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
81 def __delitem__(self, key): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
82 dict.__delitem__(self, key) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
83 self._keys.remove(key) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
84 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
85 def __setitem__(self, key, item): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
86 dict.__setitem__(self, key, item) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
87 if key not in self._keys: |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
88 self._keys.append(key) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
89 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
90 def __iter__(self): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
91 return iter(self._keys) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
92 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
93 def clear(self): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
94 dict.clear(self) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
95 self._keys = [] |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
96 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
97 def copy(self): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
98 d = odict() |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
99 d.update(self) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
100 return d |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
101 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
102 def items(self): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
103 return zip(self._keys, self.values()) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
104 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
105 def keys(self): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
106 return self._keys[:] |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
107 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
108 def setdefault(self, key, failobj = None): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
109 dict.setdefault(self, key, failobj) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
110 if key not in self._keys: |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
111 self._keys.append(key) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
112 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
113 def update(self, dict): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
114 for (key, val) in dict.items(): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
115 self[key] = val |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
116 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
117 def values(self): |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
118 return map(self.get, self._keys) |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
119 |
27fba894d3ca
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
47
diff
changeset
|
120 |
1 | 121 try: |
122 relpath = os.path.relpath | |
123 except AttributeError: | |
124 def relpath(path, start='.'): | |
29 | 125 """Compute the relative path to one path from another. |
126 | |
130 | 127 >>> relpath('foo/bar.txt', '').replace(os.sep, '/') |
44 | 128 'foo/bar.txt' |
130 | 129 >>> relpath('foo/bar.txt', 'foo').replace(os.sep, '/') |
44 | 130 'bar.txt' |
130 | 131 >>> relpath('foo/bar.txt', 'baz').replace(os.sep, '/') |
44 | 132 '../foo/bar.txt' |
133 | |
29 | 134 :return: the relative path |
135 :rtype: `basestring` | |
136 """ | |
1 | 137 start_list = os.path.abspath(start).split(os.sep) |
138 path_list = os.path.abspath(path).split(os.sep) | |
139 | |
140 # Work out how much of the filepath is shared by start and path. | |
141 i = len(os.path.commonprefix([start_list, path_list])) | |
142 | |
143 rel_list = [os.path.pardir] * (len(start_list) - i) + path_list[i:] | |
144 return os.path.join(*rel_list) | |
29 | 145 |
106
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
146 ZERO = timedelta(0) |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
147 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
148 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
149 class FixedOffsetTimezone(tzinfo): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
150 """Fixed offset in minutes east from UTC.""" |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
151 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
152 def __init__(self, offset, name=None): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
153 self._offset = timedelta(minutes=offset) |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
154 if name is None: |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
155 name = 'Etc/GMT+%d' % offset |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
156 self.zone = name |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
157 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
158 def __str__(self): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
159 return self.zone |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
160 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
161 def __repr__(self): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
162 return '<FixedOffset "%s" %s>' % (self.zone, self._offset) |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
163 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
164 def utcoffset(self, dt): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
165 return self._offset |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
166 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
167 def tzname(self, dt): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
168 return self.zone |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
169 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
170 def dst(self, dt): |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
171 return ZERO |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
172 |
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
173 |
29 | 174 try: |
175 from pytz import UTC | |
176 except ImportError: | |
106
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
177 UTC = FixedOffsetTimezone(0, 'UTC') |
29 | 178 """`tzinfo` object for UTC (Universal Time). |
179 | |
180 :type: `tzinfo` | |
181 """ | |
95
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
182 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
183 STDOFFSET = timedelta(seconds = -time.timezone) |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
184 if time.daylight: |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
185 DSTOFFSET = timedelta(seconds = -time.altzone) |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
186 else: |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
187 DSTOFFSET = STDOFFSET |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
188 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
189 DSTDIFF = DSTOFFSET - STDOFFSET |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
190 |
106
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
191 |
95
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
192 class LocalTimezone(tzinfo): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
193 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
194 def utcoffset(self, dt): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
195 if self._isdst(dt): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
196 return DSTOFFSET |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
197 else: |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
198 return STDOFFSET |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
199 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
200 def dst(self, dt): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
201 if self._isdst(dt): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
202 return DSTDIFF |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
203 else: |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
204 return ZERO |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
205 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
206 def tzname(self, dt): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
207 return time.tzname[self._isdst(dt)] |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
208 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
209 def _isdst(self, dt): |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
210 tt = (dt.year, dt.month, dt.day, |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
211 dt.hour, dt.minute, dt.second, |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
212 dt.weekday(), 0, -1) |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
213 stamp = time.mktime(tt) |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
214 tt = time.localtime(stamp) |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
215 return tt.tm_isdst > 0 |
008cd3f7d485
Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents:
62
diff
changeset
|
216 |
106
9b22b36066f6
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
97
diff
changeset
|
217 |
97 | 218 LOCALTZ = LocalTimezone() |
219 """`tzinfo` object for local time-zone. | |
220 | |
221 :type: `tzinfo` | |
222 """ |