This is safe.

On Saturday, 18 August 2012 20:35:43 UTC-5, howesc wrote:
>
> yes i use modules, and current, but in the form of:
>
> from gluon import current
>
> def module_func():
>    if current.request.args:
>       do something
>    return
>
> that is threadsafe right?
>
> in either case, when i had the problems reported in the other thread i was 
> not using current in modules.
>
> On Saturday, August 18, 2012 1:47:55 PM UTC-7, Massimo Di Pierro wrote:
>>
>> Do you use modules? Do you do anything like
>>
>> from gluon import current
>> request =  current.request # very very thread unsafe!!!
>>
>> Massimo
>>
>>
>> On Saturday, 18 August 2012 11:27:31 UTC-5, howesc wrote:
>>>
>>> i agree that it is GAE specific.  i've never had a problem elsewhere. 
>>>
>>> On 8/17/12 22:19 , Massimo Di Pierro wrote: 
>>> > I opened an issue on googlecode. If there is a problem with thread 
>>> safety 
>>> > it is GAE specific. There is some logic created in the early days to 
>>> cache 
>>> > things on GAE assuming one process per request. 
>>> > 
>>> > On Friday, 17 August 2012 23:11:34 UTC-5, howesc wrote: 
>>> >> 
>>> >> db, auth, response was getting overwritten mid-request.  see 
>>> >> 
>>> https://groups.google.com/forum/?fromgroups#!topic/web2py/aaG7YK7fddg[1-25] 
>>> >> 
>>> >> On 8/17/12 19:49 , Massimo Di Pierro wrote: 
>>> >>> What kind of thread problems did you have on GAE? 
>>> >>> 
>>> >>> On Friday, 17 August 2012 16:23:17 UTC-5, howesc wrote: 
>>> >>>> 
>>> >>>> response.include_file() outputs the files that were added to 
>>> >>>> response.files (js, css).  when you remove that you loose the auto 
>>> >> output 
>>> >>>> of files that were added to response.files along the way. 
>>> >>>> 
>>> >>>> response.include_mete() works much the same for HTML meta 
>>> properties. 
>>> >>>> 
>>> >>>> can we see the resulting HTML in both cases?  in the first case 
>>> (when 
>>> >> it 
>>> >>>> fails completely) you get HTML right?  but jquery.js fails to load 
>>> so 
>>> >> other 
>>> >>>> things on your site might break.  in the second case it sounds like 
>>> >> jquery 
>>> >>>> does load, but you are missing other files so your site breaks?  or 
>>> do 
>>> >> you 
>>> >>>> get no HTML to the browesr in either case? 
>>> >>>> 
>>> >>>> as an aside - how is threadsafe working for you on GAE?  i had some 
>>> >>>> problems with it myself....perhaps i have bad code. :) 
>>> >>>> 
>>> >>>> thanks, 
>>> >>>> 
>>> >>>> cfh 
>>> >>>> 
>>> >>>> On Thursday, August 16, 2012 1:29:00 PM UTC-7, Akash Kakkar wrote: 
>>> >>>>> 
>>> >>>>> Hi, 
>>> >>>>> 
>>> >>>>> I have tried deploying an earlier version of my app on gae and was 
>>> >>>>> successful, unfortunately the product release version of my app is 
>>> >>>>> faltering when I try to run locally on gae before deploying and 
>>> was 
>>> >> getting 
>>> >>>>> undefined error. In the process of debugging I made changes in my 
>>> >> app.yaml 
>>> >>>>> file which is as below (deleted the skip files portion). I noticed 
>>> >> that 
>>> >>>>> with this when I try to run the application I get the following 
>>> error: 
>>> >>>>> <type 'exceptions.IOError'> [Errno 13] file not accessible: 
>>> >>>>> 
>>> '/home/akash/webdev/web2py/applications/docmatorx/static/js/jquery.js' 
>>> >>>>> 
>>> >>>>>    According to me the problem is with web2py_ajax.html file. 
>>> which if 
>>> >> I 
>>> >>>>> leave blank the application runs (though the layout.html 
>>> functionality 
>>> >> and 
>>> >>>>> the topbar vanishes) 
>>> >>>>> 
>>> >>>>> //original web2py_ajax.html 
>>> >>>>> <script type="text/javascript"> 
>>> >>>>>       var w2p_ajax_confirm_message = "{{=T('Are you sure you want 
>>> to 
>>> >>>>> delete this object?')}}"; 
>>> >>>>>       var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}"; 
>>> >>>>>       var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d 
>>> %H:%M:%S')}}"; 
>>> >>>>>       </script> 
>>> >>>>> {{ 
>>> >>>>> response.files.insert(0,URL('static','js/jquery.js')) 
>>> >>>>> response.files.insert(1,URL('static','css/calendar.css')) 
>>> >>>>> response.files.insert(2,URL('static','js/calendar.js')) 
>>> >>>>> response.files.insert(3,URL('static','js/web2py.js')) 
>>> >>>>> response.include_meta() 
>>> >>>>> response.include_files() 
>>> >>>>> }} 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> #*app.yaml* 
>>> >>>>> #  For Google App Engine deployment, copy this file to app.yaml 
>>> >>>>> #  and edit as required 
>>> >>>>> #  See 
>>> >> http://code.google.com/appengine/docs/python/config/appconfig.html 
>>> >>>>> #  and http://web2py.com/book/default/chapter/11?search=app.yaml 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> application: <my app as registered on GAE> 
>>> >>>>> version: 1 
>>> >>>>> api_version: 1 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> # use this line for Python 2.5 
>>> >>>>> # 
>>> >>>>> # runtime: python 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> # use these lines for Python 2.7 
>>> >>>>> # upload app with: appcfg.py update web2py (where 'web2py' is 
>>> web2py's 
>>> >>>>> root directory) 
>>> >>>>> # 
>>> >>>>> runtime: python27 
>>> >>>>> threadsafe: yes    # true for WSGI & concurrent requests (Python 
>>> 2.7 
>>> >>>>> only) 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> default_expiration: "24h"   # for static files 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> handlers: 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> - url: /(?P<a>.+?)/static/(?P<b>.+) 
>>> >>>>>     static_files: applications/\1/static/\2 
>>> >>>>>     upload: applications/(.+?)/static/(.+) 
>>> >>>>>     secure: optional 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> - url: /favicon.ico 
>>> >>>>>     static_files: applications/welcome/static/favicon.ico 
>>> >>>>>     upload: applications/welcome/static/favicon.ico 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> - url: /robots.txt 
>>> >>>>>     static_files: applications/welcome/static/robots.txt 
>>> >>>>>     upload: applications/welcome/static/robots.txt 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> - url: .* 
>>> >>>>> # script: gaehandler.py         # CGI 
>>> >>>>>     script: gaehandler.wsgiapp    # WSGI (Python 2.7 only) 
>>> >>>>>     secure: optional 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> admin_console: 
>>> >>>>>     pages: 
>>> >>>>>     - name: Appstats 
>>> >>>>>       url: /_ah/stats 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> builtins: 
>>> >>>>> - default: on 
>>> >>>>> - remote_api: on 
>>> >>>>> - appstats: on 
>>> >>>>> - admin_redirect: on 
>>> >>>>> - deferred: on 
>>> >>>>> - django_wsgi: on 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> It would be nice If someone can tell me what is going wrong or if 
>>> I 
>>> >> can 
>>> >>>>> get information on what files are included in the following 
>>> statements 
>>> >>>>> response.include_meta() 
>>> >>>>> response.include_files() 
>>> >>>>> 
>>> >>>>> My application runs (with limited layout features probably because 
>>> of 
>>> >> not 
>>> >>>>> including the meta and add on files) if I edit the 
>>> web2py_ajax.html 
>>> >> file to 
>>> >>>>> : 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> <script type="text/javascript"><!-- 
>>> >>>>>       // These variables are used by the web2py_ajax_init function 
>>> in 
>>> >>>>> web2py_ajax.js (which is loaded below). 
>>> >>>>>       var w2p_ajax_confirm_message = "{{=T('Are you sure you want 
>>> to 
>>> >>>>> delete this object?')}}"; 
>>> >>>>>       var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}"; 
>>> >>>>>       var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d 
>>> %H:%M:%S')}}"; 
>>> >>>>>       //--></script> 
>>> >>>>> <script src="{{=URL('static','js/jQuery.js')}}" 
>>> >>>>>           type="text/javascript"></script> 
>>> >>>>> <script src="{{=URL('static','css/calendar.css')}}" 
>>> >>>>>           type="text/javascript"></script> 
>>> >>>>> <script src="{{=URL('static','js/calendar.js')}}" 
>>> >>>>>           type="text/javascript"></script> 
>>> >>>>> <script src="{{=URL('static','css/web2py.css')}}" 
>>> >>>>>           type="text/javascript"></script> 
>>> >>>>> <script src="{{=URL('static','js/web2py.js')}}" 
>>> >>>>>           type="text/javascript"></script> 
>>> >>>>> 
>>> >>>>> Thank You for your Help. 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>>>> 
>>> >>> 
>>> >> 
>>> >> 
>>> > 
>>>
>>>

-- 



Reply via email to