Thanks again, Niphlod. I am getting close to finish what i want to do :-)

I can see that I get the time zone. After changing the timezone a few
times, I am not seeing it any more.....

I am trying to trouble shoot this. I figured that i need to close my
browser, but this doesn't seem to make it work again...

please visit:
        http://127.0.0.1:8000/
starting browser...
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {'timezone': 'Asia/Shanghai'}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {'timezone': 'Asia/Shanghai'}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {'timezone': 'Africa/Johannesburg'}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {'timezone': 'Africa/Johannesburg'}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {'timezone': 'Africa/Johannesburg'}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {'timezone': 'America/Los_Angeles'}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>

C:\Users\lab\Downloads\web2py>python web2py.py
No handlers could be found for logger "web2py"
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.4.5-stable+timestamp.2013.03.18.22.46.22
Database drivers available: SQLite(sqlite3), MySQL(pymysql),
PostgreSQL(pg8000), MS
odbc), Ingres(pyodbc), IMAP(imaplib)
please visit:
        http://127.0.0.1:8000/
starting browser...
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
please visit:
        http://172.27.169.52:8000/
starting browser...
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
<Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>
Hi, you should save this  <Storage {}>





On Fri, Apr 19, 2013 at 12:39 AM, Niphlod <[email protected]> wrote:

> fast_tz_detector returns a SCRIPT().
> Of course you can't "read it" because the page executes it, so it's fine
> if you see a blank space:
> If you see the page source (using firefox, right click --> View page
> source) you'd see a <script>blablablabla</script>
>
> On the "let's save it to the database" topic ..... try it yourself:
>
> def index():
>     print 'Hi, you should save this ', request.vars
>     some_message = "here timezone is detected"
>     tz = fast_tz_detector()
>     return ....
>
> When you return a "fast_tz_detector()", as soon as the browser loads the
> page, javascript detects the timezone and it is sent back to the same
> controller function (in this case, "index").
>
> Another way is to "hack it up" somewhere
>
> def index():
>     if session.plugin_timezone_tz:
>            db.sometable.insert(
> detected_timezone=session.plugin_timezone_tz, user_id=auth.user_id)
>
>     some_message = "here timezone is detected"
>     tz = fast_tz_detector()
>
>     return .....
>
>
>
>
>
> On Friday, April 19, 2013 3:58:09 AM UTC+2, fun man wrote:
>
>> hi Niphlod,
>>
>> I've tried your example in the attachment. The good news is that the user
>> selected timezone it the profile/register page is working consistently!
>> Great work! Thank you!
>>
>> The bad news is that the dynamic detection, and return from the client
>> session is still not working...
>> def index():
>>     some_message = "here timezone is detected"
>>     tz = fast_tz_detector()
>>
>> I found out that tz is still not returning anything in the index page.
>> That should be my landing page, and once this is detected. I want to move
>> this value to the db. Then use it for the rest of the other functions in
>> the application.
>>
>> I am reading your plugin, and it will take me some time to really figure
>> out what is going on inside fast_tz_detector()... Not sure why it didn't
>> return the thing I want :-)
>>
>>
>> On Thu, Apr 18, 2013 at 6:08 PM, fun man <[email protected]> wrote:
>>
>>> Sorry Niphlod. I was on my phone, and didn't see this attachment. Thanks
>>> again for helping me out without asking for anything. I will try to learn
>>> from your example.
>>>
>>>
>>> On Fri, Apr 19, 2013 at 8:33 AM, Funmanhk <[email protected]> wrote:
>>>
>>>> Btw, I want to say that Niphlod has been very helpful. I am definitely
>>>> missing the HTML+JS knowledge, but that didn't stop me to try out in web2py
>>>> and have a good attempt on this issue.
>>>>
>>>> I am one little step away from solving this time zone problem haunting
>>>> me for a few months.  I wouldn't have the courage to start this adventure
>>>> without seeing the community's effort here.
>>>>
>>>> Thanks Niphlod, and everyone to create and support this.
>>>>
>>>> On 19 Apr, 2013, at 3:13, Niphlod <[email protected]> wrote:
>>>>
>>>> packed an app with a few examples: might explain better how to deal
>>>> with timezones.
>>>>
>>>> On Thursday, April 18, 2013 6:20:18 PM UTC+2, fun man wrote:
>>>>>
>>>>> yes. I am with you. I didn't store timezone in the db, and will be
>>>>> using UTC for all input to the db too.
>>>>>
>>>>> I hope to find a way to use the detected timezone to use in the
>>>>> .represent method for the sqlform.grid.
>>>>>     db.prototype.modified_on.**repre**sent = lambda value, row :
>>>>> pytz.UTC.localize(value).**astim**ezone(pytz.timezone('**Asia/**Tokyo'))
>>>>>
>>>>>
>>>>> The above is working for me. I basically hardcode it to 'Asia/Tokyo'.
>>>>> I am trying to get the value from your plugin to replace my hard coded one
>>>>> above.
>>>>>
>>>>>
>>>>> On Fri, Apr 19, 2013 at 12:41 AM, Niphlod <[email protected]> wrote:
>>>>>
>>>>>> the whole point of timezone normalization is NOT having "a timezone
>>>>>> attached at the end".
>>>>>> It's storing in the database as UTC and displaying as "localized" to
>>>>>> the users.
>>>>>> Are we sure that you fully grasped what the timezone implementation
>>>>>> on the IS_DATE* validators in web2py and that that idea fits with your 
>>>>>> one ?
>>>>>>
>>>>>>
>>>>>> On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:
>>>>>>
>>>>>>> i am not using any specific language translation. It should be the
>>>>>>> default language.
>>>>>>>
>>>>>>> i also think that it is timezone issue, but not very sure how to do
>>>>>>> the normalization. The model i use is     Field('modified_on', 
>>>>>>> 'datetime'),
>>>>>>> I see that there is no timezone attached at the end.
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Apr 18, 2013 at 7:11 PM, Niphlod <[email protected]> wrote:
>>>>>>>
>>>>>>>> that seems more a problem with the format of the date than the fact
>>>>>>>> that it has to be "timezone-normalized"....what language translation 
>>>>>>>> are
>>>>>>>> you using ?
>>>>>>>>
>>>>>>>> PS: what I meant with "landing page" is that you're sure that the
>>>>>>>> user will hit that page before arriving to the form.
>>>>>>>> If you are sure, there's no need to embed the LOADed fragment in
>>>>>>>> the form page
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> ---
>>>>>>>> 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/*
>>>>>>>> *to****pic/web2py/aV1nNiDIwiY/**unsubsc****ribe?hl=en<https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en>
>>>>>>>> .
>>>>>>>>  To unsubscribe from this group and all its topics, send an email
>>>>>>>> to web2py+un...@**googlegroups.com.
>>>>>>>>
>>>>>>>> For more options, visit https://groups.google.com/**grou****
>>>>>>>> ps/opt_out <https://groups.google.com/groups/opt_out>.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>
>>>>>> ---
>>>>>> 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/**
>>>>>> to**pic/web2py/aV1nNiDIwiY/**unsubsc**ribe?hl=en<https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en>
>>>>>> .
>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>> web2py+un...@**googlegroups.com.
>>>>>> For more options, visit 
>>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>>> .
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>  --
>>>>
>>>> ---
>>>> 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<https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en>
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> web2py+un...@**googlegroups.com.
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>>
>>>>
>>>> <web2py.app.fun_man.w2p>
>>>>
>>>>
>>>
>>  --
>
> ---
> 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].
> 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.


Reply via email to