Problems with IdentityManagement

1 view
Skip to first unread message

Sandro Ribeiro

unread,
Apr 2, 2006, 12:27:27 PM4/2/06
to TurboGears
Hey guys,

My first post here ;) I have installed 0.9a2 and I am quite impressed!

I'm playing with IdentityManagement and I had some errors... I created
a demo project called 'y' and, basically using the start example at
Trac, made some modifications to use different classes:

---
[app.cfg]
# The classes you wish to use for your Identity model. Leave these
commented out
# to use the default classes for SqlObjectIdentityProvider. Or set them
to the
# classes in your model. NOTE: These aren't TG_* because the TG prefix
is
# reserved for classes created by TurboGears.
identity.soprovider.model.user="y.model.Usr"
identity.soprovider.model.group="y.model.Grp"
identity.soprovider.model.permission="y.model.Prm"

---
[model.py]
from sqlobject import *
from turbogears.database import PackageHub
# Uncomment the following line if you wish to use Identity and
SO_Provider
from turbogears.identity.soprovider import TG_User, TG_Group,
TG_Permission

hub = PackageHub("y")
__connection__ = hub

class Usr(TG_User):
pass

class Grp(TG_Group):
pass

class Prm(TG_Permission):
pass

---

The rest was changed following the "Quick start example". I started the
application, went to http://localhost:8080/login, typed random stuff,
and received this error after submit:

---

500 Internal error

The server encountered an unexpected condition which prevented it from
fulfilling the request.

Traceback (most recent call last):
File
"C:\Python24\lib\site-packages\cherrypy-2.2.0rc1-py2.4.egg\cherrypy\_cphttptools.py",
line 97, in _run
applyFilters('before_main')
File
"C:\Python24\lib\site-packages\cherrypy-2.2.0rc1-py2.4.egg\cherrypy\filters\__init__.py",
line 151, in applyFilters
method()
File
"C:\Python24\lib\site-packages\turbogears-0.9a2-py2.4.egg\turbogears\visit.py",
line 163, in before_main
plugin.record_request( visit )
File
"C:\Python24\lib\site-packages\turbogears-0.9a2-py2.4.egg\turbogears\identity\visitor.py",
line 158, in record_request
identity= self.identity_from_request(visit.id)
File
"C:\Python24\lib\site-packages\turbogears-0.9a2-py2.4.egg\turbogears\identity\visitor.py",
line 84, in identity_from_request
identity= source(visit_id)
File
"C:\Python24\lib\site-packages\turbogears-0.9a2-py2.4.egg\turbogears\identity\visitor.py",
line 141, in identity_from_form
identity= self.provider.validate_identity( user_name, pw, visit_id
)
File
"C:\Python24\lib\site-packages\turbogears-0.9a2-py2.4.egg\turbogears\identity\soprovider.py",
line 193, in validate_identity
user= user_class.byUserId( user_name )
File "<string>", line 1, in <lambda>
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\main.py",
line 1266, in _SO_fetchAlternateID
result, obj = cls._findAlternateID(name, dbName, value, connection)
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\inheritance\__init__.py",
line 221, in _findAlternateID
result = list(cls.selectBy(connection, **{name: value}))
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\sresults.py",
line 155, in __iter__
return iter(list(self.lazyIter()))
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\sresults.py",
line 163, in lazyIter
return conn.iterSelect(self)
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\dbconnection.py",
line 770, in iterSelect
select, keepConnection=True)))
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\inheritance\iteration.py",
line 10, in __init__
super(InheritableIteration, self).__init__(dbconn, rawconn, select,
keepConnection)
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\dbconnection.py",
line 701, in __init__
self.dbconn._executeRetry(self.rawconn, self.cursor, self.query)
File
"C:\Python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobject\dbconnection.py",
line 297, in _executeRetry
return cursor.execute(query)
OperationalError: no such table: tg_user

---

Am I doing something wrong? Did I forget something? I already deleted
the database (SQLite file) and re-created it using `tg-admin sql
create`.

Thanks in advance!

Sandro Ribeiro

unread,
Apr 2, 2006, 5:59:55 PM4/2/06
to TurboGears
A "workaround"...

1) Open app.cfg, and comment the "identity.soprovider" lines:
# identity.soprovider.model.user="y.model.Usr"
# identity.soprovider.model.group="y.model.Grp"
# identity.soprovider.model.permission="y.model.Prm"

2) Run the application. Result? All TG_* tables are created...

3) Kill the app, go back to app.cfg, remove the comments from
"identity.soprovider" lines.

4) Run the application again. No more errors!

To test it, I opened a tg-admin shell and added an user/group, like
the example (but using my classes, Usr and Grp). Login is working!

Reply all
Reply to author
Forward
0 new messages