Database schema changes after adding a user

0 views
Skip to first unread message

Felix Schwarz

unread,
Dec 12, 2006, 7:47:00 AM12/12/06
to turbo...@googlegroups.com
Hi all,

my database schema changed after I added a user (Catwalk).

1. Use tg-admin quickstart and enable identity support
2. start cherrypy development server
3. "tg-admin toolbox", add a "User" with the Catwalk
4. point your browser to "localhost:8080"

After that I get a 500 error page: "DatabaseError: database schema has changed"

Traceback is:
------------------------------------------------------------------------------------
Exception in thread VisitManager:
Traceback (most recent call last):
File "/usr/lib64/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/usr/lib/python2.4/site-packages/turbogears/visit/api.py", line 256, in run
self.update_queued_visits(queue)
File "/usr/lib/python2.4/site-packages/turbogears/visit/sovisit.py", line 73, in
update_queued_visits
conn.query( conn.sqlrepr(u) )
File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py", line 732, in query
return self._dbConnection._query(self._connection, s)
File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py", line 300, in _query
self._executeRetry(conn, conn.cursor(), s)
File "/usr/lib/python2.4/site-packages/sqlobject/dbconnection.py", line 295, in
_executeRetry
return cursor.execute(query)
File "/usr/lib64/python2.4/site-packages/sqlite/main.py", line 244, in execute
self.rs = self.con.db.execute(SQL)
DatabaseError: database schema has changed
------------------------------------------------------------------------------------

Why does this happen? I did not expect a schema change after adding a user...

To diagnose the problem, I added the following code to "index(self)":
> connection = User._connection._dbConnection._conn
> cursor = connection.cursor()
> cursor.execute('SELECT name FROM sqlite_master WHERE type = "table"')
> print cursor.fetchall()

This is essentially a "SHOW TABLES" emulation in sqlite.

Before adding the user, the output is:
> [('visit',), ('tg_user',), ('tg_group',), ('user_group',), ('group_permission',), ('permission',), ('tg_visit_identity',)]

Afterwards (after setp 4, restarted cherrypy), there *are* more tables:
> [('visit',), ('tg_user',), ('tg_group',), ('user_group',), ('group_permission',), ('permission',), ('tg_visit_identity',), ('tg_visit',), ('tg_permission',), ('visit_identity',)]

Especially the tables "permission"/"tg_permission", "visit"/"tg_visit" and
"visit_identity"/"tg_visit_identity" seem odd to me.

Is there an error in the generated model? How can I fix this?

fs

Felix Schwarz

unread,
Dec 12, 2006, 8:29:53 AM12/12/06
to turbo...@googlegroups.com

after some grep'ing, I found that tg_permission, tg_visit_identity and tg_visit are hard
coded in identity/soprovider.py and visit/sovisit.py. I think that either the generated
coded should be changed to adapt to the hardcoded names or identity/soprovider.py and
visit/sovisit.py should no hardcode names with the prefix "tg_". Is this correct? In this
case, I can file a bug report.

fs

Jorge Godoy

unread,
Dec 12, 2006, 8:47:58 AM12/12/06
to turbo...@googlegroups.com
Felix Schwarz <felix....@web.de> writes:

Sorry, I might be missing the point, but aren't these references to the
classes you indicate in your application configuration? There's no hardcoded
name but there are default names: model.User -- that by default points to
tg_user --, model.Group -- points to tg_group -- and so on.

--
Jorge Godoy <jgo...@gmail.com>

Reply all
Reply to author
Forward
0 new messages