Note, if you're going to add your own objects to current, you might want to 
do so in a special namespace, such as current.app. That way, if web2py 
later adds some of its own additional objects to current, you don't have to 
worry about the names conflicting with your custom objects.

Anthony

On Sunday, July 8, 2012 11:24:18 AM UTC-4, cornelinux wrote:
>
>  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 
> currentobject, 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_magicTM 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
>>
>>   
>  

Reply via email to