Hi,

I started to try out niphlod's timezone plugin 
(https://github.com/niphlod/w2p_timezone_plugin) only to realize that my 
web2py doesn't recognize the timezone attribute of the IS_DATE* validators.

It was then that I noticed the 2.5.4 web2py version that it works with. Any 
ideas when this will get into the mainstream or am I missing something?

Thanks,
Valdeck


On Thursday, March 21, 2013 at 10:33:42 AM UTC-5, Massimo Di Pierro wrote:
>
> I have a major patch from Niphlod that replace my 
> naive implementation with one based on pytz. I agree this is the way to go. 
> We have two open issues:
> 1) should be include pytz in web2py r make it a depencency
> 2) should we do the pytz import in web2py or should we pass pytz objects 
> to validators (the pytz would be defined outside of web2py), tus giving the 
> option of not using pytz.
>
> On Thursday, 21 March 2013 05:28:09 UTC-5, mart wrote:
>>
>> hum... I use this and solves pretty much the bulk of the DLST issues that 
>> were problematic for me.
>>
>> http://pytz.sourceforge.net  (its the Olsen TZ DB wrapped in python)
>>
>> I found it a little tricky at first, but once i got my head wrapped 
>> around the different permutations of 
>> dates (past, presents, different time zones, DLST, DT formats) i work 
>> with, things cleared up pretty 
>> quickly.
>>
>> Anyways, works for me.
>>
>> - Mart
>>
>>
>> On Sunday, March 17, 2013 7:31:24 PM UTC-7, Massimo Di Pierro wrote:
>>>
>>> I was looking at code to detect the user timezone and store dates 
>>> consistently in UTC format.
>>> I made some changes in trunk to handle this. I could use some help 
>>> testing.
>>>
>>> 1) In the header of your layout.html add:
>>>
>>>  {{if not session.timezone:}}
>>>   <script>
>>>     
>>> jQuery(function(){jQuery.post('{{=URL('default','set_timezone')}}',{timezone:(new
>>>  
>>> Date()).getTimezoneOffset()});});
>>>   </script>
>>> {{pass}}
>>>
>>> 2) in the default controller:
>>>
>>> def set_timezone():
>>>     session.timezone = int(request.vars.timezone)/60
>>>
>>> 3) Use the new timezone attribute of validators in trunk:
>>>
>>>    Field('birthday','datetime',requires = 
>>> IS_DATETIME(timezone=session.timezone)
>>>
>>> Does it work for you? Suggestions for improvement?
>>>
>>> Massimo
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to