Commit d0a6fd1f authored by Michal Čihař's avatar Michal Čihař

Use timezone support from Django

Issue #892
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 2fa80706
...@@ -30,7 +30,7 @@ from django.core.urlresolvers import reverse ...@@ -30,7 +30,7 @@ from django.core.urlresolvers import reverse
import os import os
import codecs import codecs
from translate.storage import poheader from translate.storage import poheader
from datetime import datetime, timedelta from datetime import timedelta
from weblate import appsettings from weblate import appsettings
from weblate.lang.models import Language from weblate.lang.models import Language
...@@ -874,9 +874,9 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -874,9 +874,9 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
author = get_author_name(user) author = get_author_name(user)
# Update po file header # Update po file header
po_revision_date = ( now = timezone.now()
datetime.now().strftime('%Y-%m-%d %H:%M') + poheader.tzstring() if not timezone.is_aware(now):
) now = timezone.make_aware(now)
# Prepare headers to update # Prepare headers to update
headers = { headers = {
...@@ -884,7 +884,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -884,7 +884,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
'last_translator': author, 'last_translator': author,
'plural_forms': self.language.get_plural_form(), 'plural_forms': self.language.get_plural_form(),
'language': self.language_code, 'language': self.language_code,
'PO_Revision_Date': po_revision_date, 'PO_Revision_Date': now.strftime('%Y-%m-%d %H:%M%z'),
} }
# Optionally store language team with link to website # Optionally store language team with link to website
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment