View Single Post
Old 01-23-2011, 09:42 AM   #1
spedinfargo
Groupie
spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.spedinfargo is the king of the Divan.
 
Posts: 155
Karma: 106422
Join Date: Nov 2010
Device: none
Problem with Article Date in parse_index

I'm having an issue trying to override the default date/time that gets put in the article. The strange thing is that it seems to work fine in one of my recipes but can't get it to "take" in the other recipe.

When I do a self.log on the result of my regular expression, everything looks fine. But when the EPUB file gets created, it defaults to the date that would get generated if I had passed in a blank string to the article dictionary: [Sun, 23 Jan 08:36]

I should be able to use any string that I want for the date, correct? Or is there something in the EPUB generation that tries to detect a valid date or something?

Any help appreciated...

Here is my code:

Code:
                    pattern2 = r'AID=\/(.*?)\/'
                    reg2 = re.compile(pattern2, re.IGNORECASE|re.DOTALL)
                    match2 = reg2.search(thisurl)
                    if match2:
                        c = time.strptime(match2.group(1),"%Y%m%d")
                        mydate=time.strftime("%a, %b %d, %Y", c)
                    else:
                        mydate = time.strftime("%a, %b %d, %Y")
                    self.log(mydate)
                    
                    articles.append({
                                      'title'      :thistitle
                                     ,'date'       :' {' + mydate + '}'
                                     ,'url'        :thisurl
                                     ,'description':description
                                    })
spedinfargo is offline   Reply With Quote