Merge lp:~gesha/linaro-license-protection/use-datetime-module into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Georgy Redkozubov
Status: Merged
Merged at revision: 122
Proposed branch: lp:~gesha/linaro-license-protection/use-datetime-module
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 21 lines (+2/-2)
1 file modified
license_protected_downloads/views.py (+2/-2)
To merge this branch: bzr merge lp:~gesha/linaro-license-protection/use-datetime-module
Reviewer Review Type Date Requested Status
Deepti B. Kalakeri (community) Approve
Review via email: mp+121400@code.launchpad.net

Description of the change

Return values of some functions in time modules are affected by the locale. This branch switches to datetime module instead of time.

To post a comment you must log in.
Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

+ 1 looks good.
Do we still need to import time ?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'license_protected_downloads/views.py'
--- license_protected_downloads/views.py 2012-08-27 10:02:15 +0000
+++ license_protected_downloads/views.py 2012-08-27 10:59:22 +0000
@@ -5,6 +5,7 @@
5import re5import re
6import time6import time
7from mimetypes import guess_type7from mimetypes import guess_type
8from datetime import datetime
89
9from django.conf import settings10from django.conf import settings
10from django.http import (11from django.http import (
@@ -67,8 +68,7 @@
67 file = os.path.join(path, file)68 file = os.path.join(path, file)
6869
69 if os.path.exists(file):70 if os.path.exists(file):
70 mtime = time.strftime('%d-%b-%Y %H:%M',71 mtime = datetime.fromtimestamp(os.path.getmtime(file)).strftime('%d-%b-%Y %H:%M')
71 time.localtime(os.path.getmtime(file)))
72 else:72 else:
73 # If the file we are looking at doesn't exist (broken symlink for73 # If the file we are looking at doesn't exist (broken symlink for
74 # example), it doesn't have a mtime.74 # example), it doesn't have a mtime.

Subscribers

People subscribed via source and target branches