02-19-2011, 07:08 PM | #1 |
Groupie
Posts: 155
Karma: 106422
Join Date: Nov 2010
Device: none
|
Tip: Article Date needs to be Unicode String
See my other thread here, but wanted to start a new thread in case anyone else ran into this tricky little issue.
When sending in your own date to create an article: articles.append({ 'title' :thistitle ,'url' :thisurl ,'date' :u' [' + mydate + ']' ,'description':description You MAY need to make sure the date is a Unicode string in some instances. For instance, I had this code to parse a number and create a formatted string for my date: c = time.strptime(match2.group(1),"%Y%m%d") mydate=time.strftime("%a, %b %d, %Y", c) However, when I went to use mydate like this, it always got blown away and the recipe always reverted back to the current date: ,'date' :' [' + mydate + ']' Just adding the "u" in front of what I was passing in seemed to do the trick. It's not consistent, though - it might only happen if you're converting to a string using the strftime (I had another recipe where I didn't have to do this). Maybe there's something in the actual string that I'm sending in that is causing it to fail. Possible bug? |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with Article Date in parse_index | spedinfargo | Recipes | 5 | 02-19-2011 07:12 PM |
Trying to strip the date from an article URL | Finbar127 | Recipes | 1 | 02-17-2011 03:02 PM |
Bulk Changing Published Date To Date | hmf | Calibre | 4 | 10-19-2010 10:19 PM |
Up-to-date candy teacher (date being 1921) | kacir | Deals and Resources (No Self-Promotion or Affiliate Links) | 0 | 06-16-2010 04:18 PM |
new official shipping date / US invitation date | R2D2 | iRex | 18 | 07-06-2006 02:32 PM |