diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 000ed0a..955a822 100644
a
|
b
|
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
185 | 185 | src = open(os.path.join(dirpath, file), "rU").read() |
186 | 186 | src = pythonize_re.sub('\n#', src) |
187 | 187 | thefile = '%s.py' % file |
188 | | open(os.path.join(dirpath, thefile), "w").write(src) |
| 188 | f = open(os.path.join(dirpath, thefile), "w") |
| 189 | try: |
| 190 | f.write(src) |
| 191 | finally: |
| 192 | f.close() |
189 | 193 | cmd = 'xgettext -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (domain, os.path.join(dirpath, thefile)) |
190 | 194 | msgs, errors = _popen(cmd) |
191 | 195 | if errors: |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
199 | 203 | else: |
200 | 204 | msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8') |
201 | 205 | if msgs: |
202 | | open(potfile, 'ab').write(msgs) |
| 206 | f = open(potfile, 'ab') |
| 207 | try: |
| 208 | f.write(msgs) |
| 209 | finally: |
| 210 | f.close() |
203 | 211 | os.unlink(os.path.join(dirpath, thefile)) |
204 | 212 | elif domain == 'django' and (file_ext == '.py' or file_ext in extensions): |
205 | 213 | thefile = file |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
207 | 215 | src = open(os.path.join(dirpath, file), "rU").read() |
208 | 216 | thefile = '%s.py' % file |
209 | 217 | try: |
210 | | open(os.path.join(dirpath, thefile), "w").write(templatize(src)) |
| 218 | f = open(os.path.join(dirpath, thefile), "w") |
| 219 | try: |
| 220 | f.write(templatize(src)) |
| 221 | finally: |
| 222 | f.close() |
211 | 223 | except SyntaxError, msg: |
212 | 224 | msg = "%s (file: %s)" % (msg, os.path.join(dirpath, file)) |
213 | 225 | raise SyntaxError(msg) |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
229 | 241 | else: |
230 | 242 | msgs = msgs.replace('charset=CHARSET', 'charset=UTF-8') |
231 | 243 | if msgs: |
232 | | open(potfile, 'ab').write(msgs) |
| 244 | f = open(potfile, 'ab') |
| 245 | try: |
| 246 | f.write(msgs) |
| 247 | finally: |
| 248 | f.close() |
233 | 249 | if thefile != file: |
234 | 250 | os.unlink(os.path.join(dirpath, thefile)) |
235 | 251 | |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
237 | 253 | msgs, errors = _popen('msguniq --to-code=utf-8 "%s"' % potfile) |
238 | 254 | if errors: |
239 | 255 | raise CommandError("errors happened while running msguniq\n%s" % errors) |
240 | | open(potfile, 'w').write(msgs) |
| 256 | f = open(potfile, 'w') |
| 257 | try: |
| 258 | f.write(msgs) |
| 259 | finally: |
| 260 | f.close() |
241 | 261 | if os.path.exists(pofile): |
242 | 262 | msgs, errors = _popen('msgmerge -q "%s" "%s"' % (pofile, potfile)) |
243 | 263 | if errors: |
244 | 264 | raise CommandError("errors happened while running msgmerge\n%s" % errors) |
245 | 265 | elif not invoked_for_django: |
246 | 266 | msgs = copy_plural_forms(msgs, locale, domain, verbosity) |
247 | | open(pofile, 'wb').write(msgs) |
| 267 | f = open(pofile, 'wb') |
| 268 | try: |
| 269 | f.write(msgs) |
| 270 | finally: |
| 271 | f.close() |
248 | 272 | os.unlink(potfile) |
249 | 273 | |
250 | 274 | |
diff --git a/tests/regressiontests/forms/localflavor/se.py b/tests/regressiontests/forms/localflavor/se.py
index 44bd953..2d92761 100644
a
|
b
|
tests = r"""
|
12 | 12 | >>> olddate = datetime.date |
13 | 13 | >>> datetime.date = MockDate |
14 | 14 | >>> datetime.date.today() |
15 | | MockDate(2008, 5, 14) |
| 15 | ...MockDate(2008, 5, 14) |
16 | 16 | |
17 | 17 | |
18 | 18 | # SECountySelect ##################################################### |