timezone

Vasil Kolev vasil at ludost.net
Tue Sep 9 08:37:51 EST 2008


В 19:25 +0200 на 08.09.2008 (пн), troels knak-nielsen написа:
> Hi list.
> 
> I've just set up venus, and I'm having problems with displaying dates.
> Strictly speaking, the dates are correct, but they are UTC, and my
> local timezone isn't. How do I make everything render with my
> preferred timezone?
> 
> (I'm using django templates if that matters)


I have a small patch for this, to be able to display the localtime
instead of the gmtime, you'll have just to use 'date_local' instead of
'date' in the template:

diff -ur v1/venus/planet/shell/tmpl.py venus/planet/shell/tmpl.py
--- v1/venus/planet/shell/tmpl.py       2007-06-25 17:03:38.000000000
+0300
+++ venus/planet/shell/tmpl.py  2007-09-07 12:23:56.000000000 +0300
@@ -101,6 +101,7 @@
     ['date_822', Rfc822, 'updated_parsed'],
     ['date_iso', Rfc3399, 'published_parsed'],
     ['date_iso', Rfc3399, 'updated_parsed'],
+    ['date_local', PlanetDate, 'updated_parsed'],
     ['enclosure_href', String, 'links', {'rel': 'enclosure'}, 'href'],
     ['enclosure_length', String, 'links', {'rel': 'enclosure'},
'length'],
     ['enclosure_type', String, 'links', {'rel': 'enclosure'}, 'type'],
@@ -223,6 +224,9 @@
     output['date_iso'] = Rfc3399(date)
     output['date_822'] = Rfc822(date)
 
+    date2 = time.localtime()
+    output['date_local'] = PlanetDate(date2)
+
     # remove new_dates and new_channels that aren't "new"
     date = channel = None
     for item in output['Items']:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: =?UTF-8?Q?=D0=A2=D0=BE=D0=B2=D0=B0?=
	=?UTF-8?Q?_=D0=B5?= =?UTF-8?Q?_=D1=86=D0=B8=D1=84=D1=80=D0=BE=D0=B2=D0=BE?=
	=?UTF-8?Q?_=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B0?=
	=?UTF-8?Q?_=D1=87=D0=B0=D1=81=D1=82?= =?UTF-8?Q?_=D0=BE=D1=82?=
	=?UTF-8?Q?_=D0=BF=D0=B8=D1=81=D0=BC=D0=BE=D1=82=D0=BE?=
Url : /archives/devel/attachments/20080909/1ec48696/attachment.pgp 


More information about the devel mailing list