--On Montag, 23. Mai 2005 20:40 Uhr +0200 Lennart Regebro <[EMAIL PROTECTED]> wrote:

On 5/23/05, Andreas Jung <[EMAIL PROTECTED]> 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."""

Attachment: pgpeGhgEb2Hr3.pgp
Description: PGP signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to