One alternative is :
if request.is_local or request.env.cmd_options.shell:
# developer configuration
else:
# production configuration
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Nice explanation Anthony. Thank you.
--
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
I try to use request.is_local to divide production enviroment and
development. But with this behaviour, it fail when i go to shell.
Is ' request.env.remote_addr ' the solution?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source
Are you just trying to determine if you're in the shell or not? If so, you
can do:
if request.env.cmd_options.shell:
print You're in the shell
Anthony
On Wednesday, April 30, 2014 5:22:16 PM UTC-4, Cássio Botaro wrote:
I try to use request.is_local to divide production enviroment and
I suppose technically, .is_local isn't really meaningful in the shell, as
there is no HTTP request involved (.is_local refers to the source of an
HTTP request). When the request object is created, .is_local defaults to
False, and it is only set to True if an HTTP request comes in from
Does it work if ajxa=True? What are the [0][0] for?
ajax=True ofcourse doesn't work, because it's loads after response
page.
[0][0] is to unwrap loaded content
On 7 июн, 13:43, pbreit pbreitenb...@gmail.com wrote:
Does it work if ajxa=True? What are the [0][0] for?
I don't think calls to LOAD are local requests (even with ajax=False) -- the
call to LOAD simply passes the original request environment to the component
controller action.
What you need is a way to determine if a request has come in via a call to
LOAD. In that case, request.env should
Note, you can probably even use an auth decorator, similar to checking for
ajax-loaded components via request.cid (see
http://www.web2py.com/book/default/chapter/13#Trapped-Ajax-Links).
@auth.requires(request.env.http_web2py_component_location)
def some_block():
Also, note that testing for
thank you
On 7 июн, 19:50, Anthony abasta...@gmail.com wrote:
Note, you can probably even use an auth decorator, similar to checking for
ajax-loaded components via request.cid
(seehttp://www.web2py.com/book/default/chapter/13#Trapped-Ajax-Links).
10 matches
Mail list logo