[Zope-dev] Possible 2.8b2 bug part 3:
Andreas Jung
lists at andreas-jung.com
Tue May 24 13:22:57 EDT 2005
--On Montag, 23. Mai 2005 20:40 Uhr +0200 Lennart Regebro
<regebro at gmail.com> wrote:
> On 5/23/05, Andreas Jung <lists at andreas-jung.com> wrote:
>> A deprecation warning could do the job. To be honest I would have never
>> thought about
>> such a usecase :-) However we could convert unicode to utf8 and use this
>> as argument
>> for strftime() and converting the result back to unicode.
>
> Yeah, that works. Is there cases when this would not work?
Please check if the following patch works for you:
Index: DateTime.py
===================================================================
--- DateTime.py (revision 30488)
+++ DateTime.py (working copy)
@@ -1488,10 +1488,18 @@
tzdiff = _tzoffset(ltz, self._t) - _tzoffset(self._tz, self._t)
zself = self + tzdiff/86400.0
microseconds = int((zself._second - zself._nearsec) * 1000000)
- return datetime(zself._year, zself._month, zself._day,
zself._hour,
+ convertback = False
+ if isinstance(unicode, format):
+ format = format.encode('utf-8')
+ convertback = True
+ ds = datetime(zself._year, zself._month, zself._day, zself._hour,
zself._minute, int(zself._nearsec),
microseconds).strftime(format)
+ if convertback:
+ ds = unicode(ds, 'utf-8')
+ return ds
+
# General formats from previous DateTime
def Date(self):
"""Return the date string for the object."""
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20050524/e98168b3/attachment.bin
More information about the Zope-Dev
mailing list