Closed GoogleCodeExporter closed 9 years ago
This is an inconsistency within feedparser, but it's not something that will be
fixed in time for the next release due to existing applications' expectations.
You do appear to be confusing two distinct sources of dates, but even if that's
the case it only highlights why this needs to be changed:
`result.feed.updated` is always a string representing when the feed was last
modified *according to the XML file itself*
`result.updated` is always a 9-tuple representing when the feed was last
modified *according to the server*.
The string version of the HTTP Last-Modified header is available in
`result.headers['last-modified']` (or 'Last-Modified' in Python 3). Regardless,
for consistency feedparser needs to store the string version in
`result.updated` and the parsed 9-tuple version in `result.updated_parsed`.
Again, this will break existing applications, so the fix won't be in the next
release.
Thank you for reporting this, Adam! I'll get it fixed sometime after the next
release.
Original comment by kurtmckee
on 24 Jan 2011 at 11:51
updated
can be either a 9-tuple or a string, depending on contextThanks Kurt!
Original comment by adamjer...@gmail.com
on 25 Jan 2011 at 3:01
[deleted comment]
did you happen to get a chance to look at this ?
i'm asking because i just tripped over something very similar which i believe
is related:
as opposed to the sample usage shown at http://www.feedparser.org (cool page
btw - zero guff, just hard facts :-),
>>> e.updated_parsed
does not return
(2005, 11, 9, 11, 56, 34, 2, 313, 0)
but
time.struct_time(tm_year=2005, tm_mon=11, tm_mday=9, tm_hour=11, tm_min=56,
tm_sec=34, tm_wday=2, tm_yday=313, tm_isdst=0)
at least on my current mac osx machine.
so while strictly speaking this is a different attribute than what it mentioned
in the bug report, i hazard a guess that the issues are related.
in the meantime, is there any recommendation for a workaround ? i thought about
using the 'native' i.e. unparsed date/time string coming straight from the
source, but it seems every provider uses a different format and i might have to
try quite a few strptime formats, something i would really like to avoid...
Original comment by steven.s...@gmail.com
on 26 Aug 2011 at 4:33
[deleted comment]
@Steven: I'm going to look at this as soon as possible, and as time permits.
I'm really sorry for the delay!
@jeftine: I'm tired of you spamming the feedparser issue tracker. Don't come
back.
Original comment by kurtmckee
on 28 Aug 2011 at 2:04
Fixed in r593.
@Steven: Python's `time.struct_time` is basically a named tuple. You can
iterate over it like a tuple and specify slices and so forth, but you can also
pick out a particular value by name, such as `e.updated_parsed.tm_year`. You
can also convert it to a tuple if you don't need the additional functionality,
but it's not necessary.
Original comment by kurtmckee
on 12 Sep 2011 at 2:58
updated
can be a 9-tuple or a string, depending on context
Original issue reported on code.google.com by
adamjer...@gmail.com
on 24 Jan 2011 at 8:37