My favorites
▼
|
Sign in
feedformatter
A Python library for generating news feeds in RSS and Atom formats
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
3
attachment: feedformatter-correct_datetime.patch
(1.4 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- /home/schnouki/dev/pkg/python-feedformatter/src/feedformatter-0.4/feedformatter.py 2009-06-09 14:07:50.000000000 +0200
+++ feedformatter.py 2009-11-17 15:38:56.000000000 +0100
@@ -28,6 +28,7 @@
__version__ = "0.4"
from cStringIO import StringIO
+import types
# This "staircase" of import attempts is ugly. If there's a nicer way to do
# this, please let me know!
@@ -52,7 +53,7 @@
except ImportError:
feedformatterCanPrettyPrint = False
-from time import time, strftime, localtime, mktime, struct_time, timezone
+from time import time, strftime, strptime, localtime, mktime, struct_time, timezone
# RSS 1.0 Functions ----------
@@ -144,14 +145,11 @@
elif type(time) is int or type(time) is float:
# Assume this is a seconds-since-epoch time
return localtime(time)
- elif type(time) is str:
- if time.isalnum():
- # String is alphanumeric - a time stamp?
- try:
- return strptime(time, "%a, %d %b %Y %H:%M:%S %Z")
- except ValueError:
- raise Exception("Unrecongised time format!")
- else:
+ elif type(time) in types.StringTypes:
+ # A time stamp?
+ try:
+ return strptime(time, "%a, %d %b %Y %H:%M:%S %Z")
+ except ValueError:
# Maybe this is a string of an epoch time?
try:
return localtime(float(time))
Powered by
Google Project Hosting