Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Django': 0.03; 'subject:Python': 0.06; 'python': 0.11; 'django': 0.11; 'jan': 0.12; 'template': 0.14; '2.7.3': 0.16; 'release:': 0.16; 'skip:t 110': 0.16; 'x86_64': 0.16; 'modification': 0.16; '>>>': 0.22; 'import': 0.22; '+0000': 0.22; 'id:': 0.23; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'van': 0.27; 'gives': 0.31; 'received:10.0.0': 0.31; 'os,': 0.31; 'time:': 0.31; 'linux': 0.33; 'subject:time': 0.33; 'charset:us-ascii': 0.36; 'received:10.0': 0.36; 'wrong': 0.37; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'e-mail:': 0.61; 'more': 0.64; 'received:nl': 0.74; '7.4': 0.84; 'skip:s 80': 0.84; '2013,': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=vanwingerde.nl; h=date :from:to:subject:message-id:mime-version:content-type :content-transfer-encoding; s=postfix; bh=f9i1CWsV7v+eVvRsaFYES6 updro=; b=psefOzHPbLxXW7zaAaB1ohsGTHHBewP+3hjIHQEBDHrcIinSYIfd4s FC0l81I+SRLdoggXF2ZH7T6lFAldgpc28p9PK/DYpblWDV/2JWw+8cHzZ2ZBUDT4 xkxScnrA8n3lwmpxTrGvmi9XbClcAcikfH1H4O/kyWZCScc2m+wN0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=vanwingerde.nl; h=date:from :to:subject:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=postfix; b=ED906Phz5LYvDKH0 BsvnaIVNrLA4pbdtdesv8cE+hzT2r/8ouFdcEbQdfvMM07Uey8oipuVbclwSrsvt j4uHaJ7g0Z6HXtX2r4LnW/qSDdsYAJmci3pD6GyUups+XQVUYiRbhiYDQcEEEf5+ +6XAcYAP6R5FdXk9/q6exWCs7jM= Date: Mon, 3 Mar 2014 13:35:41 +0000 From: Jaap van Wingerde To: python-list@python.org Subject: modification time in Python - Django: datetime != datetime :-( Organization: Yellow matter custard X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 03 Mar 2014 14:40:44 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393854045 news.xs4all.nl 2898 [2001:888:2000:d::a6]:42047 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67541 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