Hello Anthony,

ok, now I got it.
I also added some more objects to the current object in db.py and thus
got rid of some parameters.

Thanks and kind regards
Cornelius

Am 08.07.2012 15:15, schrieb Anthony:
> Models, controllers, and views are executed in an environment that
> includes all the web2py API objects
> <http://web2py.com/books/default/chapter/29/4#API>, including request,
> response, session, etc. The objects added to the environment by the
> models are also available in the controllers and views (which are
> executed after the models) -- so if you define db and auth in the
> models, they will be available in the controllers and views. The
> objects created in the controller are not generally available in the
> views, but the items returned in a dict by a controller action are
> available in the views.
> See http://web2py.com/books/default/chapter/29/4#Workflow.
>
> If you want these objects available in modules, you can use the
> current object, or pass them as arguments, as you have been doing. For
> more about using current,
> see 
> http://web2py.com/books/default/chapter/29/4#Accessing-the-API-from-Python-modules.
>
> Anthony
>
> On Sunday, July 8, 2012 8:48:54 AM UTC-4, cornelinux wrote:
>
>     Hi,
>     I think I am missing some of the major concepts of web2py.
>
>     By some_magic^TM is got some object like "db", "request" and
>     "auth" available in all my controllers.
>     I think these are setup in db.py.
>     Anyway, still strange for me.
>
>     What would I need to do, when I want to make these available in
>     some lib/modules?
>     At the moment I always pass db and request as parameters.
>     But as these modules are only used with my web2py project, I want
>     to get rid of passing these parameters.
>
>     Thanks a lot and kind regards
>     Cornelius
>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to