Re: How to edit dexterity types without needing to know about their behaviors
Andreas Jung <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Johannes Raggam wrote:
> On Fri, 2014-03-14 at 11:25 +0100, Johannes Raggam wrote:
>> On Fri, 2014-03-14 at 02:46 -0700, ajung wrote:
>>> ajung wrote
>>>> johannes raggam wrote
>>>>> i'll fix that, probably at the wine and beer sprint. but then
>>>>> you'll still always get UTC datetime values instead of
>>>>> localized ones, if you get the start/end attributes directly
>>>>> from the context.
>>>>>
>>>>>> Consistency-is-king Andreas
>>>>> pragmatism is okay. johannes
>>> Here are the facts why plone.app.event currently freaks me out.
>>>
>>> The source 'start' object is v = DateTime('2008/09/09 09:00:00
>>> GMT+2') which translates to 07:00 UTC.
>>>
>>> The migration code tries to concert the DateTime instance to a
>>> Python datetime instance with UTC timezone and setting the
>>> 'timezone' of the event object to 'Etc/GMT+2' using
>>>
>>> v = v.asdatetime() tz = str(v.tzinfo) if tz.startswith('GMT'): tz
>>> = 'Etc/%s' % tz new_obj.timezone = tz acc =
>>> IEventAccessor(new_obj) v =
>>> v.replace(tzinfo=pytz.timezone('UTC')) setattr(acc, k, v)
>> first, are you sure, that you want to use Etc/GMT+2 as timezone?
>> Etc/GMT is not GMT, see the answer here:
>> http://answers.yahoo.com/question/index?qid=20090707145844AANnghH
>>
>>>>> import pytz from datetime import datetime vie =
>>>>> pytz.timezone('Europe/Vienna') etc =
>>>>> pytz.timezone('Etc/GMT+2') dt = vie.localize(datetime.now())
>>>>> dt
>> datetime.datetime(2014, 3, 14, 11, 13, 11, 629280,
>> tzinfo=<DstTzInfo 'Europe/Vienna' CET+1:00:00 STD>)
>>>>> dt.astimezone(etc)
>> datetime.datetime(2014, 3, 14, 8, 13, 11, 629280,
>> tzinfo=<StaticTzInfo 'Etc/GMT+2'>)
>>
>> then, just set the timezone on the accessor and start and end
>> datetime as floating datetimes. if you don't have multiple timezone
>> in the portal you are migrating, that shouldn't be a problem.
>
> ... and make sure the ObjectModifiedEvent is fired, so that the
> data_postprocessing event handler is executed.
This is yet another reason why the implementation is _broken_ - I wonder
how one can design and implement such a simple functionality this way.
This is just scary.
- -aj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQGUBAEBAgAGBQJTItq7AAoJEADcfz7u4AZj6AsLwNiFitCQ5j5eXb3YmjF7muLM
m+dP2zd8De9R2JOUsthcxBRv4E0VaFpdGkG7DG2ZF41txX+vISv+ASmLG1vsmNpp
++aJmM5cmMJvE2gonBmf770uQMPcHOFv+IwR73zu6Yf5ROI8Dx76qIrZU7qwJxo1
2Dt/h+X4qkVqsqZEwVhvNqqEzh+BDhyuUVfU25CPq40AJqwW0UGP3QERR098qCV5
+KZ6KQvs17GvCL37Fe3oUuVqlS+5PtJqQT67eUe51Bz4gDnprm++S3vUx2XHzbEx
BiAW/VGinCSRnCpMP3d1pADIOwsqh0ESjcVRyEsVeyGdV8niYpAtQpTm/S1jhjxK
IqniIQtKMBWzmydpqc5134EZYeiyJ+HsZseO6wEk3FJdmVQt9oqfhtY6ftJT/seP
4qsoRX5+RzY5chHHncq4AyPiKdn3XXcFJV88asiuhi8MA0fYA4cHzAYTPZKq0PXI
gPMaaZdpgmBjJ21uD1n6bCHxmLKku4E=
=Kep6
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech