Re: [web2py] using the DAL standalone

2011-06-06 Thread Martín Mulone
I don't think you can do this now or soon I think because auth depends too
much from session, response, and request and all of this are core of web2py.
But you can access to the auth_user table using dal.

2011/6/6 apple 

> I would like to be able to use the DAL to run standalone scripts to
> query a database. I have managed to get this working by adding a "from
> gluon import *" to mymodel and running the code below:
>
> import sys
> sys.path.append("c:/web2py")
> sys.path.append("c:/web2py/applications/crm/models")
> from gluon import *
> from mymodel import *
> result = db(db["customer"]).select()
> print(result)
>
> However if there is a reference to auth then I need to also change
> mymodel to include:
>  from gluon.tools import *
>  auth = Auth(globals(),db)
> This fails because there is no request. Is there a way round this to
> make web2py think it is running a server?




-- 
 http://martin.tecnodoc.com.ar


[web2py] using the DAL standalone

2011-06-06 Thread apple
I would like to be able to use the DAL to run standalone scripts to
query a database. I have managed to get this working by adding a "from
gluon import *" to mymodel and running the code below:

import sys
sys.path.append("c:/web2py")
sys.path.append("c:/web2py/applications/crm/models")
from gluon import *
from mymodel import *
result = db(db["customer"]).select()
print(result)

However if there is a reference to auth then I need to also change
mymodel to include:
  from gluon.tools import *
  auth = Auth(globals(),db)
This fails because there is no request. Is there a way round this to
make web2py think it is running a server?