Re: [web2py] How to share a function between controllers

2011-10-18 Thread Jonathan Lundell
On Oct 18, 2011, at 12:52 AM, Manuele wrote: > On 17/10/2011 23:14, Jonathan Lundell wrote: >> Or import it from a module. > but modules don't have direct access to the db... True, but you can pass the db to your functions. > maybe the two easiest ways are: > > 1. define it in a model file... a

Re: [web2py] How to share a function between controllers

2011-10-18 Thread Tito Garrido
Thank you! On Tue, Oct 18, 2011 at 5:52 AM, Manuele wrote: > On 17/10/2011 23:14, Jonathan Lundell wrote: > >> Or import it from a module. >> > but modules don't have direct access to the db... maybe the two easiest > ways are: > > 1. define it in a model file... at least in a mylib.py file sepa

Re: [web2py] How to share a function between controllers

2011-10-18 Thread Manuele
On 17/10/2011 23:14, Jonathan Lundell wrote: Or import it from a module. but modules don't have direct access to the db... maybe the two easiest ways are: 1. define it in a model file... at least in a mylib.py file separeted to the main db.py or other file you use to define models. 2. use t

Re: [web2py] How to share a function between controllers

2011-10-17 Thread Jonathan Lundell
On Oct 17, 2011, at 2:04 PM, Tito Garrido wrote: > I have a function that will need to be used on at least 3 controllers... This > function will need to have access to the database and doesn't need a view > since it will just return True or False. > > What is the best way to implement it? My fi

[web2py] How to share a function between controllers

2011-10-17 Thread Tito Garrido
Hi folks! I have a function that will need to be used on at least 3 controllers... This function will need to have access to the database and doesn't need a view since it will just return True or False. What is the best way to implement it? My first idea was to put this function inside the model.