Re: [Zope-dev] Possible 2.8b2 bug part 3:
On 5/23/05, Andreas Jung <lists@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? -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
--On Montag, 23. Mai 2005 20:40 Uhr +0200 Lennart Regebro <regebro@gmail.com> wrote:
On 5/23/05, Andreas Jung <lists@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?
utf8 should cover the whole unicode database, shouldn't it?! -aj
--On Montag, 23. Mai 2005 20:40 Uhr +0200 Lennart Regebro <regebro@gmail.com> wrote:
On 5/23/05, Andreas Jung <lists@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."""
participants (2)
-
Andreas Jung -
Lennart Regebro