#5013 RSS feed pubDate incorrect after upgrade [ss765]

v1.0.0
closed
nobody
General
2015-08-20
2012-09-27
Chris Tsai
No

[forge:site-support:#765]

When we upgraded, all of our news articles had their pubDate set to the time that the upgrade occurred. The date is still set correctly on the news page https://sourceforge.net/p/warlock/news/ .

Incorrect dates can be seen here: https://sourceforge.net/p/warlock/news/feed

Related

Tickets: #5013
Tickets: #5179

Discussion

  • Dave Brondsema

    Dave Brondsema - 2012-10-02
    • milestone: limbo --> forge-oct-19
     
  • Dave Brondsema

    Dave Brondsema - 2012-10-05
    • size: --> 1
     
  • Dave Brondsema

    Dave Brondsema - 2012-10-24
    • labels: support, p3, migration --> support, p3, migration, 42cc
     
  • Igor Bondarenko - 2012-10-25

    Created #196: [#5013] Set proper pubDate for news in RSS feed during migration (1cp)

     

    Related

    Tickets: #5013

  • Igor Bondarenko - 2012-10-25
    • status: open --> in-progress
     
  • Igor Bondarenko - 2012-10-30
    • status: in-progress --> code-review
     
  • Igor Bondarenko - 2012-10-30

    Closed #196. Branch 42cc_5013 in allura repo.

    The problem requires a fix just in allura repo. We've changed BlogPost.commit method to use date of post publication when creating a Feed item, so feed dates will be set properly during migration.

     
  • Dave Brondsema

    Dave Brondsema - 2012-10-30

    There is one potential sneaky bug in here. In python, default values for arguments are bound once when the class is loaded and not each time the method is run. So pubdate could be stuck at one time. Trivial example:

    In [2]: from datetime import datetime
    
    In [3]: def post(pubdate=datetime.utcnow()):
       ...:     print pubdate
       ...: 
    
    In [4]: post()
    2012-10-30 14:31:21.778490
    
    In [5]: post()
    2012-10-30 14:31:21.778490
    
    In [6]: post()
    2012-10-30 14:31:21.778490
    
     
  • Dave Brondsema

    Dave Brondsema - 2012-10-30
    • status: code-review --> in-progress
    • qa: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2012-10-30

    Oh, and the general way to work around this is like:

    In [7]: def post(pubdate=None):
       ...:     if pubdate is None:
       ...:         pubdate = datetime.utcnow()
    
     
  • Igor Bondarenko - 2012-10-31

    Ow, that's right, we'll fix that.

    Created #201: [#5013] Don't use utcnow in default value for pubdate argument (1cp)

     

    Related

    Tickets: #5013

  • Igor Bondarenko - 2012-10-31

    Closed #201. All changes in 42cc_5013.

     
  • Igor Bondarenko - 2012-10-31
    • status: in-progress --> code-review
     
  • Dave Brondsema

    Dave Brondsema - 2012-10-31
    • status: code-review --> closed
    • milestone: forge-nov-16 --> forge-nov-02
     

Log in to post a comment.