Re: [Zope-dev] Possible 2.8b2 bug part 3:

2005-05-25 Thread Lennart Regebro
On 5/24/05, Andreas Jung [EMAIL PROTECTED] wrote:
 +if isinstance(unicode, format):

Well, this should be if isinstance(format, unicode): of course.
But besides that, yes it works.

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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 )


[Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Lennart Regebro
DateTime.DateTime.strftime(fmt) used to use strftime, which accepts a
unicode string as fmt. In 2.8 it uses datetime.datetime.strftime which
does not accept unicode.

This both breaks backwards compatibility, and  prevents you from using
non-ascii characters in the format string.

Thoughts, opinions?
-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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 )


Re: [Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 19:22 Uhr +0200 Lennart Regebro 
[EMAIL PROTECTED] wrote:



DateTime.DateTime.strftime(fmt) used to use strftime, which accepts a
unicode string as fmt. In 2.8 it uses datetime.datetime.strftime which
does not accept unicode.

This both breaks backwards compatibility, and  prevents you from using
non-ascii characters in the format string


hm...I am not sure if the time.strftime() implementation had been 
implemented
with unicode format strings in mind. Accepting Unicode strings (maybe 
without
checking them) appears to me more like  an unintended accident than 
intentional
behavior. I am pretty sure you can build a workaround easily. In my point 
of view
the reason for the change (support for dates outside the usual 1970..2038 
scope)

is more important.


Andreas


pgpxlJdrO5Gcx.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 )


Re: [Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Lennart Regebro
On 5/23/05, Andreas Jung [EMAIL PROTECTED] wrote:
 I am pretty sure you can build a workaround easily. In my point of view
 the reason for the change (support for dates outside the usual 1970..2038
 scope) is more important.

Well, I don't think we personally use any non-ascii characters, so we
can work around it, but it does break backwards compatibility.

We get an error when we use localize time and date strings, something
I expect is pretty common, i.e., you translate a string
medium_date_format with whatever translation tool you have, and then
pass that as a date format.

The translation tools will typically return unicode, and bam! it stops
working. So, if we can't properly support unicode, I'd actually prefer
that we cast the format string to string, perhaps with a deprecated
warning if we pass unicode?

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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 )


Re: [Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Andreas Jung



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


The translation tools will typically return unicode, and bam! it stops
working. So, if we can't properly support unicode, I'd actually prefer
that we cast the format string to string, perhaps with a deprecated
warning if we pass unicode?



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.

Andreas



pgpX7OG2BmiST.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 )


Re: [Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Lennart Regebro
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?

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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 )


Re: [Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Andreas Jung



--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?


utf8 should cover the whole unicode database, shouldn't it?!

-aj


pgph8RhC8lzC7.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 )