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 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/groups/opt_out.