Re: [Zope3-dev] XXX Roundup

2006-01-03 Thread Stephan Richter
On Friday 16 December 2005 16:20, Benji York wrote:
 Stephan zope/viewlet/README.txt:147

Okay, I converted this one to a TODO, which it really is.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Finished zope/i18n/format.py XXX (was Re: [Zope3-dev] XXX Roundup)

2005-12-20 Thread Gary Poster


On Dec 19, 2005, at 2:41 PM, Gary Poster wrote:

On Dec 17, 2005, at 4:06 PM, Gary Poster wrote:

On Dec 16, 2005, at 4:20 PM, Benji York wrote:

Gary zope/i18n/format.py:141 and 149

Update, if anyone needs to follow along:

...

This is fixed in trunk and 3.2 branch.  Thanks to Stuart Bishop for  
his feedback and help.


Gary
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] XXX Roundup

2005-12-17 Thread Gary Poster


On Dec 16, 2005, at 4:20 PM, Benji York wrote:

Gary zope/i18n/format.py:141 and 149


(Not entirely sure why Benji blessed me with this assignment ;-) ,  
but...)


As I wrote before, this is an evil bug caused by a misuse of pytz  
code: timezones in this code can be pickled, but then not unpickled,  
so they lie in wait, waiting to explode next time you try to get the  
object .  Exciting!


Jim and I have agreed that the best way to approach this is to offer  
a patch to Stuart for an intelligently-persistable offset-based  
timezone, such as that found in zope.app.datetimeutils, and then use  
that in the 18n code.


I don't have time for that this weekend, and there's no guarantee we  
could even get an ok from Stuart for this in time.


I also have an approach that pukes when you try to persist one of  
these timezones, but then some of the timezones returnable from the  
method are persistable, and some not: another fairly evil trap.


If someone else has desire and time to tackle this, go for it.  If  
not, I'll try to do it on Monday.


Stuart, if you happen to read this, giving your blessing to such a  
patch would be very cool. ;-)


Gary


___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



zope.i18n.format pytz usage (was Re: [Zope3-dev] XXX Roundup)

2005-12-16 Thread Gary Poster


On Dec 16, 2005, at 4:20 PM, Benji York wrote:

Gary zope/i18n/format.py:141 and 149


Yup: the pytz StaticTzInfo is being used in a non-API way, and while  
pickling works, unpickling doesn't (ew!).


Here's the interactive prompt example, if anyone cares.

 import pytz.tzinfo
 tz = pytz.tzinfo.StaticTzInfo()
 import pickle
 import datetime
 delta = datetime.timedelta(hours=-5)
 delta
datetime.timedelta(-1, 68400)
 tz._utcoffset = delta
 pickle.dumps(tz)
'cpytz\n_p\np0\n(Ntp1\nRp2\n.'
 pickle.loads(pickle.dumps(tz))
Traceback (most recent call last):
  File stdin, line 1, in ?
  File /home/gary/z4i/var/opt/python/lib/python2.4/pickle.py, line  
1394, in loads

return Unpickler(file).load()
  File /home/gary/z4i/var/opt/python/lib/python2.4/pickle.py, line  
872, in load

dispatch[key](self)
  File /home/gary/z4i/var/opt/python/lib/python2.4/pickle.py, line  
1153, in load_reduce

value = func(*args)
  File /home/gary/z4i/var/src/zope3/src/pytz/__init__.py, line  
163, in _p

return unpickler(*args)
  File /home/gary/z4i/var/src/zope3/src/pytz/tzinfo.py, line 340,  
in unpicklertz = pytz.timezone(zone)
  File /home/gary/z4i/var/src/zope3/src/pytz/__init__.py, line 47,  
in timezonezone = _munge_zone(zone)
  File /home/gary/z4i/var/src/zope3/src/pytz/__init__.py, line 71,  
in _munge_zone

return zone.replace('+', '_plus_').replace('-', '_minus_')
AttributeError: 'NoneType' object has no attribute 'replace'

This is not pytz's fault: it wasn't designed to work the way that the  
format module is using it, as Stuart points out following Philipp's  
'XXX'.


I think I can fix it by using the pytz.reference.FixedOffset class.   
That's what I'll try to do now.


Gary




___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: zope.i18n.format pytz usage (was Re: [Zope3-dev] XXX Roundup)

2005-12-16 Thread Gary Poster


On Dec 16, 2005, at 4:56 PM, Gary Poster wrote:
...
I think I can fix it by using the pytz.reference.FixedOffset  
class.  That's what I'll try to do now.


BTW, let me note that this is still bad.  These things *should not*  
be persisted: they will generate lots and lots of little instances.   
Maybe the code should use a class that refuses to be persisted instead.


Another approach would be to copy over zope.app.datetimeutils into  
zope.i18n: it has already addressed the problem.


Gary
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com