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
1=== modified file 'license_protected_downloads/views.py'
2--- license_protected_downloads/views.py 2012-08-27 10:02:15 +0000
3+++ license_protected_downloads/views.py 2012-08-27 10:59:22 +0000
4@@ -5,6 +5,7 @@
5 import re
6 import time
7 from mimetypes import guess_type
8+from datetime import datetime
9
10 from django.conf import settings
11 from django.http import (
12@@ -67,8 +68,7 @@
13 file = os.path.join(path, file)
14
15 if os.path.exists(file):
16- mtime = time.strftime('%d-%b-%Y %H:%M',
17- time.localtime(os.path.getmtime(file)))
18+ mtime = datetime.fromtimestamp(os.path.getmtime(file)).strftime('%d-%b-%Y %H:%M')
19 else:
20 # If the file we are looking at doesn't exist (broken symlink for
21 # example), it doesn't have a mtime.

Subscribers

People subscribed via source and target branches