[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 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] importing a module that has db

2014-06-29 Thread Kurt Jensen
I have a controller *articles.py*. @auth.requires_login() def edit(): art_id=request.args(0) art=db.art_articles[art_id] or redirect(error_page) form=crud.update(db.art_articles,art,next='view/[id]') import images thumbs=images.thumbs() return dict(form=form, art

[web2py] Error on fresh startup

2014-05-05 Thread Kurt Jensen
Getting error on start-up of fresh install on Fused.com hosting service account : Traceback (most recent call last): File "web2py.py", line 18, in ? import gluon.widget File "/home/iaff106/web2py/gluon/__init__.py", line 15, in ? from globals import current File "/home/iaff106/web2p

[web2py] How do I retrieve Row by id from a join query result object

2014-04-19 Thread Kurt Jensen
How can I get a row from a DAL object if I know the associated id. Example: my_phones=db((db.prof_phone.pid==person_id)&(db.prof_phone.provider>1)). select(db.prof_phone.ALL,db.provider.edomain, left=db.provider.on(db.provider.id==db.prof_phone.provider),orderby= db.prof_phone.label) Whic

[web2py] Get data associated with known id from DAL object

2014-04-19 Thread Kurt Jensen
I have a left join query: phones=db((db.prof_phone.pid==person_id)&(db.prof_phone.provider>1)).select(db.prof_phone.ALL,db.provider.edomain, left=db.provider.on(db.provider.id==db.prof_phone.provider),orderby=db.prof_phone.label) which gives me an object: phones:prof_phone.id prof_ph

[web2py] How do I "SELECT * FROM table WHERE field IN (1,2,3,4,7)

2014-04-05 Thread Kurt Jensen
How do I do : "SELECT * FROM table WHERE field IN (1,2,3,4,7) AND field2='3'"" AND / OR "DELETE FROM table WHERE field1 IN (1,2,3,4,7) AND field2='3'" in web2py DAL? I come from PHP and I am really struggling with DAL in web2py. -- Resources: - http://web2py.com - http://web2py.com/book (Doc