that's exactly what I tested yesterday evening... can you please try to
strip out the next=URL('index') part ?
It's the only thing that is different.
On Wednesday, April 17, 2013 4:14:58 AM UTC+2, fun man wrote:
>
> Hi Niphlod,
>
> I downloaded the new one, and copied the files over. Keeping my original
> model. This is now my controller.
>
> 1) fast_tz returns None,
> 2) the "submit" button to the db was not taken, and the still ask me to
> fill out the form again.
>
> Would you mind to take a look at it? thanks for your help.
>
> def test():
> fast_tz = fast_tz_detector()
> #create a new appt
> form = SQLFORM(db.sometable).process(next=URL('index'))
> if form.process().accepted:
> response.flash = 'form accepted'
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill out the form'
> return dict(form=form, fast_tz=fast_tz)
>
>
>
>
>
> On Wed, Apr 17, 2013 at 3:17 AM, Niphlod <[email protected]
> <javascript:>>wrote:
>
>>
>>
>> On Tuesday, April 16, 2013 8:10:38 PM UTC+2, fun man wrote:
>>>
>>> Hi Niphlod,
>>>
>>> I need to trouble you again for your guidance.
>>>
>>> I've successfully copied the files. I've added a new application tz_test
>>> to test the plugin.
>>>
>>> This is my controller and there are some other scaffolding coded not
>>> included.
>>> ==============================**==========================
>>> import pytz
>>> from plugin_timezone import fast_tz_detector
>>>
>>> def detect_timezone():
>>> tz = fast_tz_detector()
>>> return dict(tz=tz)
>>>
>>> def test():
>>> detect_timezone()
>>> zone = session.plugin_timezone_tz
>>> form = SQLFORM.grid(db.sometable)
>>> return dict(form=form)
>>>
>>> This is my model.
>>> =============
>>> db = DAL("sqlite://storage.sqlite")
>>> import pytz
>>> user_timezone = session.plugin_timezone_tz or 'UTC'
>>> db.define_table('sometable',
>>> Field('appointment', 'datetime',
>>> requires=IS_DATETIME(timezone=**pytz.timezone(user_timezone))
>>> )
>>> )
>>>
>>
>> Ohhh, whoopsie..... it needs a fix, sorry ^_^
>> Redownload the plugin from github.
>>
>> PS: That will work ok if a user landed on the "detect_timezone"
>> page....if you need to autodetect in the same page as the form, you should
>> be able to do
>>
>> def test():
>> fast_tz = fast_tz_detector()
>> form = yourform .....
>>
>> .....
>> return dict(form=form, fast_tz=fast_tz)
>>
>>
>> all in one shot (given that you use the generic template nothing has to
>> be done, if you use your own you need to include somewhere {{=fast_tz}} in
>> it)
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
--
---
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/groups/opt_out.