Patches item #1578415, was opened at 2006-10-16 22:34
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578415&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: ptwobrussell (ptwobrussell)
Assigned to: Oleg Broytmann (phd)
Summary: exception called b/c of issue with millisecs in date string
Initial Comment:
A patch to fix an issue caused when pgdb returns a
date/time string that contains milliseconds in it:
col.py.orig is the original file. col.py is the updated
file
Patch is inline below:
--- col.py.orig 2006-10-16 14:11:30.000000000 -0400
+++ col.py 2006-10-16 14:13:28.000000000 -0400
@@ -941,7 +941,8 @@
else:
return
datetime.time(value.hour, value.minute, int(value.second))
try:
- stime = time.strptime(value, self.format)
+ #postgres might return a time value
with milliseconds. strip it or else change the format
string
+ stime =
time.strptime(value[value.rfind('.')], self.format)
except:
raise validators.Invalid("expected an
date/time string of the '%s' format in the DateTimeCol
'%s', got %s %r instead" % \
(self.format, self.name,
type(value), value), value, state)
----------------------------------------------------------------------
>Comment By: Oleg Broytmann (phd)
Date: 2006-11-13 20:12
Message:
Logged In: YES
user_id=4799
Even with the colon the patch is invalid. It cuts the last
digit if there is no a dot. See:
> python
Python 2.4.4 (#1, Oct 23 2006, 18:00:38)
[GCC 3.4.4 20050314 (prerelease) (Debian 3.4.3-13sarge1)] on
linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> s = "20:55"
>>> s[:s.find('.')]
'20:5'
The problem you are trying to solve is a real problem but
IWBN if you produce a patch that works for other people.
----------------------------------------------------------------------
Comment By: ptwobrussell (ptwobrussell)
Date: 2006-11-11 17:37
Message:
Logged In: YES
user_id=1622325
Yea, basically, this approach just chops off the "." and
everything after it. Sorry about that. Don't know how the
":" didn't make it through. I generated the patch from my
working copy. Weird.
----------------------------------------------------------------------
Comment By: Oleg Broytmann (phd)
Date: 2006-11-10 17:22
Message:
Logged In: YES
user_id=4799
value[value.rfind('.')]? There have to be a colon somewhere:
value[:value.rfind('.')], I suppose?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578415&group_id=74338
|