Project

General

Profile

Actions

Support #2628

closed

[feed] Wrong dates / timezone mismatch in the feed regarding dates

Added by Johannes Bornhold about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
High
Assignee:
Anderson Santos
Category:
-
Target version:
Start date:
04.09.2015
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

Original source: https://rhodecode.tenderapp.com/help/discussions/questions/32206-two-different-dates-in-the-feeds

Goals:

  • Find out why the dates are differnt
  • Follow up with team/johbo to decide if further steps are needed.

Files


Related issues 1 (0 open1 closed)

Related to RhodeCode CE/EE - Bug #2641: [rss, timezone] RSS feeds should use proper timezone-aware datesClosed08.09.2015

Actions
Actions #1

Updated by Anderson Santos about 9 years ago

  • Status changed from New to In Progress
  • Assignee set to Anderson Santos
Actions #2

Updated by Anderson Santos about 9 years ago

So the problem is the timezone difference, but something is wrong with all those settings because I can't get it to ever display a matching datetime, always displaying two hours of difference.

My local machine and my VM are in timezone Berlin, when displaying the datetime on Firefox feed, the dates are different as Firefox somehow tries to set a Timezone for the given date. The attached image explains the problem.

The code on the other hand have matching datetime and a Military style timezone description, which I believe is the root of the problem.

http://www.w3.org/Protocols/rfc822/#z28

I couldn't find anything on how to set the pubdate format of the feed classes Atom1Feed/Rss201rev2Feed.

A snippet from the feed source is:


Edited file new via RhodeCode Enterprise

2015-09-08T11:51:58Z
2015-09-08T11:51:58Z
RhodeCode Admin <anderson@rhodecode.com>
tag:172.16.115.152:5000,2015-09-08:/git-break-me/changeset/70a84438c293bb159679ced2ee4c199e7937a52aadmin (RhodeCode Admin) committed on Tue, 08 Sep 2015 11:51:58<br/>branch: master<br/>changeset: <a href="http://172.16.115.152:5000/git-break-me/changeset/70a84438c293bb159679ced2ee4c199e7937a52a">70a84438</a><pre>Edited file new via RhodeCode Enterprise
M new (1 lines added, 0 lines removed)</pre>

So as you can see, our webhelper feed generates the date format as:

@2015-09-08T11:51:58Z@

Supposedly feedgenerator has a function @ rfc2822_date@ but it doesn't explain how to use it with the generator class itself.

http://sluggo.scrapping.cc/python/WebHelpers/modules/feedgenerator.html

Actions #3

Updated by Anderson Santos about 9 years ago

I fixed it by forcing a local timezone

localtz = pytz.timezone('Europe/Berlin')
feed.add_item(title=h.shorter(commit.message, 160),
link=url('changeset_home', repo_name=repo_name,
revision=commit.raw_id, qualified=True),
author_name=commit.author,
description=''.join(self.__get_desc(commit)),
pubdate=localtz.localize(commit.date),
)

then it will display matching datetimes as the screenshot shows.

Also, adding to the conversation Marcin gave a link to an old bitbucket issue regarding the problem:

https://bitbucket.org/marcinkuzminski/rhodecode/issues/629/rss-feed-of-the-journal-reports-incorrect

Conclusion was to add timezone info to that date.

Just a technical note:

Trying to use pytz automatic localization didn't seem to do the trick. Using the code below it was still displaying GMT-0 instead of my VM timezone.

pubdate=pytz.utc.localize(commit.date)

So I guess the biggest issue here is how to identify which timezone Rhodecode has.

Actions #4

Updated by Anderson Santos about 9 years ago

  • Related to Bug #2641: [rss, timezone] RSS feeds should use proper timezone-aware dates added
Actions #5

Updated by Anderson Santos about 9 years ago

  • Status changed from In Progress to Resolved

Created a follow up ticket #2641 to implement the fix

Actions #6

Updated by Anderson Santos about 9 years ago

  • Status changed from Resolved to Closed
Actions #7

Updated by Marcin Kuzminski [CTO] over 8 years ago

  • Private changed from Yes to No
Actions

Also available in: Atom PDF