Hello,

What is the recommended place in web2py folder where I should store custom 
functions that are useful to multiple applications? For example, suppose I 
have a function such as the following:

*def connecttodb():*
*    if request.is_local:*
*        user="user"*
*        passwd="passed"*
*        host="localhost"*
*    else:*
*        user="user_nonlocal"*
*        passwd="passwd_nonlocal"*
*        host="nonlocalhost"*
*    con = mdb.connect(user=user,*
*                      passwd=passwd,*
*                      host=host)*
*    c = con.cursor()*
*    return con, c*


 I will need this in every application. Further, if I decide to change the 
host, I have to go and change the values in every application. There are 
other useful functions common to all applications. Can I just store them in 
one folder and import them, so that they work both on local and web hosts? 
If so, where do you recommend I save them?

Thank you.

-- 



Reply via email to