[web2py] Re: importing a module that has db

2014-07-01 Thread 黄祥
please spend some time read web2py book. ref: http://web2py.com/books/default/chapter/29/04/the-core#Dispatching http://web2py.com/books/default/chapter/29/04/the-core#request best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web

[web2py] Re: importing a module that has db

2014-07-01 Thread Kurt Jensen
Thank You! That did it... I was missing current in *models/db.py.* Now the only problem to solve is that I can not get* URL()* in Module *images.py* to point to *http://127.0.0.1:8000/images/* When I view *http://127.0.0.1:8000/articles/edit/2* which includes module *images.py, * URL("images/sh

[web2py] Re: importing a module that has db

2014-06-30 Thread 黄祥
yes, you are right, thank you so much for the additional information, anthony. *models/db.py* from gluon import current current.db = db current.auth = auth current.mail = mail best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/w

[web2py] Re: importing a module that has db

2014-06-30 Thread Anthony
Note, you don't need to add session, response, or T (or request or cache) to current, as they are already added automatically by web2py. Anthony On Monday, June 30, 2014 8:40:50 AM UTC-4, 黄祥 wrote: > > had you already define the current in the models? > > e.g. > *models/db.py* > > from gluon imp

[web2py] Re: importing a module that has db

2014-06-30 Thread 黄祥
had you already define the current in the models? e.g. *models/db.py* from gluon import current current.db = db current.auth = auth current.mail = mail current.session = session current.response = response current.T = T best regards, stifan -- Resources: - http://web2py.com - http://web2py.com

[web2py] Re: importing a module that has db

2014-06-30 Thread Kurt Jensen
On Sunday, June 29, 2014 6:54:15 AM UTC-7, 黄祥 wrote: > > please use current.db on your module > > ref: > > http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules > > best regards, > stifan > I updated module *images.py* to read: from gluon import * def t

[web2py] Re: importing a module that has db

2014-06-29 Thread 黄祥
please use current.db on your module ref: http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.g