Confirmed bug with database administration link usage attempt

3 views
Skip to first unread message

voltron

unread,
Jan 30, 2008, 2:53:27 AM1/30/08
to web2py Web Framework
If one starts web2py from the command line:

"python web2py.py -a testpasswd -p 5000"

Web2py starts up, no problems, but the "database administration"
buttons for all the appliances do not work, it only brings up an empty
page. The only solution to this is starting web2py with no parameters:

"python web2py.py"

This brings up the Tk dialogue window, everything powers up and the
database administration works as expected.

Test configuration
---------------------------------------
Windows Vista
Python 2.5
Web2py 1.19

Is the Tk dialog doing something else?

voltron

unread,
Jan 30, 2008, 5:42:38 AM1/30/08
to web2py Web Framework
Another thing, is it by design that multiple model files do not show
up when one clicks on the database administration button? Defining 2
files like this:

models/users.py
models/partners.py

will only list the tables in the partners file, the tables declared in
the file above, in this case users are not shown at all

Markus Gritsch

unread,
Jan 30, 2008, 5:45:56 AM1/30/08
to web...@googlegroups.com

But the "examples" application *does* contain two model files db.py
and images.py.

Markus

voltron

unread,
Jan 30, 2008, 7:19:18 AM1/30/08
to web2py Web Framework
Well, I tried it several times with my own models, it only shows the
tables in the first model file in the list. Maybe you could try it out
yourself to see?

Massimo Di Pierro

unread,
Jan 30, 2008, 10:58:51 AM1/30/08
to web...@googlegroups.com
I suspect the following problem with your code:

you use the same variable to store different SQLDB objects. For example:

--- model a.py ----
db=SQLDB(...)
db.define_table(....)
--- nodel b.py ----
db=SQLDB(....) ### WRONG
db.define_table(....)
---------

this is wrong because models are executed in alphabetical order in
the same restricted environment.
the posted examples work because I use two different names "db" and
"dba".

The following solutions are both acceptable

--- model a.py ----
db=SQLDB(...)
db.define_table(....)
--- nodel b.py ----
other_db=SQLDB(....) ### OK as long as db and other_db are not the
same DB
other_db.define_table(....)
---------

OR

--- model a.py ----
db=SQLDB(...)
db.define_table(....)
--- nodel b.py ----
# db=SQLDB(....)
db.define_table(....) ### this table will be stored in the same db as
the one in a.py
---------

If this is your problem this may have unpredictable effects on the
transaction mechanism and it may also explain your problem with the
appadmin (which I cannot reproduce yet). It will also cause a memory
leak.

Does this solve the problem? If not please send me you models.

Massimo

voltron

unread,
Jan 30, 2008, 1:45:05 PM1/30/08
to web2py Web Framework
The problem with multiples files is actually separate. The first
problem is always reproduceable, every single time, let me state it
here again, if you are on windows you can try it out, I am only using
one model for this case.

yuriytk

unread,
Jan 30, 2008, 4:38:46 PM1/30/08
to web2py Web Framework
I start "python web2py.py", but the "database administration" brings
empty screen too.
My configuration: Ubuntu 7.10 Gutsy, Python 2.5.1, Web2py 1.19.

Massimo Di Pierro

unread,
Jan 30, 2008, 4:47:12 PM1/30/08
to web...@googlegroups.com
I think this is because of a security feature and some odd network
configuration.

edit the appadmin.py file of your application and remove the lines:

if request.env.remote_addr!=request.env.http_host.split(':')[0]:
raise HTTP(400)

Let me know if this fixes the problem.

massimo

yuriytk

unread,
Jan 31, 2008, 2:27:32 PM1/31/08
to web2py Web Framework
Weirdly, but today "database administration" page opens. :-)
Yesterday there was a blank page.
I didn't change anything.
Reply all
Reply to author
Forward
0 new messages