Merge lp:~daker/loco-team-portal/fix.1542697 into lp:loco-team-portal

Proposed by Adnane Belmadiaf on 2016-03-20
Status: Needs review
Proposed branch: lp:~daker/loco-team-portal/fix.1542697
Merge into: lp:loco-team-portal
Diff against target: 25 lines (+2/-2)
2 files modified
Makefile (+1/-1)
loco_directory/articles/models.py (+1/-1)
To merge this branch: bzr merge lp:~daker/loco-team-portal/fix.1542697
Reviewer Review Type Date Requested Status
Daniel Llewellyn (community) Needs Fixing on 2016-08-05
Chris Johnston 2016-03-20 Approve on 2016-03-20
Review via email: mp+289581@code.launchpad.net

Commit Message

Fixed feed date parsing

Description of the Change

Fixed feed date parsing

To post a comment you must log in.
Chris Johnston (cjohnston) :
review: Approve
Daniel Llewellyn (diddledan) wrote :

The modified parameter is not to be set by us. We are supposed to use whatever the server we're fetching-from has previously told us the feed was last modified. We should also have etag functionality included in this MR. See http://pythonhosted.org/feedparser/http-etag.html for details.

Saving the correct last-modified time should be:

self.last_updated = data.modified_parsed

and an etag would be accessed, and saved into a new field, from the response with:

self.last_etag = data.etag

we'd need to add the last_etag field into the model and update the migrations.

review: Needs Fixing

Unmerged revisions

685. By Adnane Belmadiaf on 2016-03-20

Fixed feed date parsing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2016-02-12 00:54:37 +0000
3+++ Makefile 2016-03-20 15:47:31 +0000
4@@ -39,7 +39,7 @@
5 $(django_manage) runserver
6
7 test: env apps
8- $(django_manage) test teams events venues meetings userprofiles
9+ $(django_manage) test teams events venues meetings userprofiles articles
10
11 clean:
12 rm -rf env/
13
14=== modified file 'loco_directory/articles/models.py'
15--- loco_directory/articles/models.py 2012-12-25 22:00:46 +0000
16+++ loco_directory/articles/models.py 2016-03-20 15:47:31 +0000
17@@ -68,7 +68,7 @@
18
19 if self.title is None or self.title == '':
20 self.title = data.feed.title
21- self.last_updated = datetime.datetime.fromtimestamp(time.mktime(getattr(data, 'modified', time.gmtime())))
22+ self.last_updated = datetime.datetime.fromtimestamp(time.mktime(time.gmtime()))
23 self.save()
24
25 for entry in data.entries:

Subscribers

People subscribed via source and target branches