thanks guys,
"current" works perfect,
I missed it in the huge amount of information
cheers,
Stef
On 17-02-14 1:40, Anthony wrote:
Note, instead of this method, you can now use gluon.current.
Anthony
On Sunday, February 16, 2014 6:32:13 PM UTC-5, Julio F. Schwarzbeck
wrote:
I assume that if you will use modules they'll probably be
implemented in
some kind of class, I'd personally do something similar to this..
# mymodule.py
class ModuleHelper(object):
""" Sample Helper for common methods.
"""
def __init__(self, environment):
self.request = environment['request']
self.response = environment['response']
self.session = environment['session']
self.cache = environment['cache']
self.db = environment['db']
self.auth = environment['auth']
def method(self):
self.request.get('variable', ....)
...
And when instantiating the module say from a model:
# mymodel.py
from mymodule import ModuleHelper
...
And Later in the same mymodel.py
...
# Make the module class/methods available:
my_module_helper = ModuleHelper(globals())
Now you can use my_module_helper.my_method(params) from within any
view
or controller..
Hope it helps.
Julio
On 02/16/2014 01:55 PM, Stef Mientki wrote:
> hello,
>
> how to get globals like "request" available in my own modules ?
>
> thanks,
> Stef
>
--
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 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.
--
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 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.