Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67541

modification time in Python - Django: datetime != datetime :-(

Date 2014-03-03 13:35 +0000
From Jaap van Wingerde <mailinglists@vanwingerde.nl>
Subject modification time in Python - Django: datetime != datetime :-(
Organization Yellow matter custard
Newsgroups comp.lang.python
Message-ID <mailman.7639.1393854045.18130.python-list@python.org> (permalink)

Show all headers | View raw


Django views.py:
...
pwd = os.path.dirname(os.path.realpath(__file__ ))
home_lastmod =  strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime(pwd+'/templates/art_index.html')))
...

The template gives a wrong modification time: "2014-03-02T19:03:55Z".

...
jaap@liakoster:~$ python
Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, time
>>> from time import
>>> gmtime
>>> time.strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime('/var/django/test2/art/templates/art_index.html')))  
'2014-03-02T19:03:55Z'
>>> quit()  
jaap@liakoster:~$ ls --full-time /var/django/test2/art/templates/art_index.html
-rwxrwx--- 1 lia www-data 2456 2014-03-02 19:16:55.568139590 +0000 /var/django/test2/art/templates/art_index.html
jaap@liakoster:~$ 
...

ls gives the right modification time. What is wrong?

...
jaap@liakoster:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 7.4 (wheezy)
Release:	7.4
Codename:	wheezy
jaap@liakoster:~$ uname -a
Linux liakoster.shrl.nl 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux
jaap@liakoster:~$ 
...

-- 
Jaap van Wingerde
e-mail: 1234567890@vanwingerde.nl

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

modification time in Python - Django: datetime != datetime :-( Jaap van Wingerde <mailinglists@vanwingerde.nl> - 2014-03-03 13:35 +0000

csiph-web