I'd go to disregard the %Z if you need to play with widgets that are not
supporting all the timezone related things. The final agenda is NOT letting
the user know that your backend is storing UTC dates ^_^
On Wednesday, May 7, 2014 2:37:45 PM UTC+2, Michael Beller wrote:
>
> Is there a way to temporarily override the language translation for an
> edit form (a smartgrid edit form) or would you recommend not adding the %Z
> format string in the language table? I could then add a represent with the
> timezone when needed rather than rely on the language translation (it comes
> down to set the default to include tz and remove when needed or leave
> default without tz and add when needed).
>
> auth.signature.created_on.represent = lambda value, row :
> pytz.UTC.localize(value).astimezone(timezone('US/Eastern')).strftime("%d-%m-%Y
>
> %H:%M:%S %Z")
>
>
> On Wednesday, May 7, 2014 4:41:08 AM UTC-4, Niphlod wrote:
>>
>> it's not a bug per se. The problem is that there isn't around a
>> javascript widget that maps the "python notation" to format datetime to
>> strings (or parse, the reverse operation) with a perfect 1:1 mapping . In
>> this case, you're facing the inability for the calendar widget to know what
>> "%Z" is.
>>
>> On Wednesday, May 7, 2014 4:01:29 AM UTC+2, Michael Beller wrote:
>>>
>>> While updating my app to handle timezones, I came across a problem with
>>> the datetime widget.
>>>
>>> Model:
>>> db.define_table('sometable',
>>> Field('appointment', 'datetime'),
>>> auth.signature)
>>>
>>> Controller Action:
>>> def index():
>>> grid = SQLFORM.grid(db.sometable, user_signature=False)
>>> return dict(grid=grid)
>>>
>>> Language Translation for %Y-%m-%d %H:%M:%S:
>>> %Y-%m-%d %H:%M:%S %Z
>>>
>>> If I open index.html, then select add record, then select a datetime
>>> using the widget for the appointment field, the widget inserts a value such
>>> as:
>>> 2014-05-06 21:49:59 %Z (which then produces a form validation error: "Enter
>>> date and time as 1963-08-28 14:30:59 %Z")
>>>
>>> If I manually replace the "%Z" with "EDT" then the record saves.
>>>
>>> Is this a bug?
>>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.