Exception using identity model

3 views
Skip to first unread message

Suren

unread,
Dec 11, 2006, 1:37:52 PM12/11/06
to TurboGears
I am working with sqlalchemy and postgresql and modified the model to
just include User and Role (in place of Group) and removed the
permissions class.

roles_table = Table('tg_role', metadata,
Column('role_id', Integer, primary_key=True),
Column('role_name', Unicode(16), unique=True),
)

users_table = Table('tg_user', metadata,
Column('user_id', Integer, primary_key=True),
Column('user_name', Unicode(16), unique=True),
..other parameters
)

user_role_table = Table('user_role', metadata,
Column('user_id', Integer, ForeignKey('tg_user.user_id')),
Column('role_id', Integer, ForeignKey('tg_role.role_id'))
)

tg-admin sql create works fine but am unable to start the server.
Starting it throws this exception. Any ideas what could be wrong with
the schema...

Unhandled exception in thread started by <bound method Server._start of
<cherryp
y._cpserver.Server object at 0x00D4D690>>
.......
File
"c:\python24\lib\site-packages\TurboGears-1.0b2-py2.4.egg\turbogears\iden
tity\saprovider.py", line 119, in __init__
group_class = load_class(group_class_path)
File
"c:\python24\lib\site-packages\TurboGears-1.0b2-py2.4.egg\turbogears\util
.py", line 294, in load_class
splitted_path = dottedpath.split('.')

AttributeError: 'NoneType' object has no attribute 'split'

Karl Guertin

unread,
Dec 11, 2006, 1:50:26 PM12/11/06
to turbo...@googlegroups.com
On 12/11/06, Suren <surendra....@gmail.com> wrote:
> I am working with sqlalchemy and postgresql and modified the model to
> just include User and Role (in place of Group) and removed the
> permissions class.

You can't change the model of the identity framework and expect it to work.

Your error is caused by a missing group object:

> group_class = load_class(group_class_path)

Suren

unread,
Dec 11, 2006, 2:11:19 PM12/11/06
to TurboGears
That's good to know. Thx.

Suren

unread,
Dec 11, 2006, 2:15:18 PM12/11/06
to TurboGears
I was able to muck with the model using SQLObject and the default
database. I was trying to reproduce the same changes using SQLAlchemy
and PostGreSQL.

Suren

unread,
Dec 13, 2006, 10:37:42 AM12/13/06
to TurboGears
Karl,

I am not quite sure if I understood your reply. If I go change the
model and recreate the database, is there a higher up authority
deciding for me that I can only have a Group object? If so, why does it
work with SQLObject?

Thanks,
Suren

Patrick Lewis

unread,
Dec 13, 2006, 11:59:32 AM12/13/06
to TurboGears
The SqlObject identity provider defaults to using identity's internal
TG_Group class if you don't define a group class in your config. So
you really do have a group class defined. If you check your database,
you probably have a 'tg_group' table in there.

The SqlAlchemy identity provider doesn't do that. You need to define a
group class in your config (as well as a permissions class).

suttaniya

unread,
Jan 19, 2007, 10:18:56 AM1/19/07
to TurboGears
i got the same error.

File
"/var/lib/python-support/python2.4/turbogears/identity/visitor.py",
line 50, in create_extension_model
provider= create_default_provider()
File
"/var/lib/python-support/python2.4/turbogears/identity/__init__.py",
line 26, in create_default_provider
return plugin()
File
"/var/lib/python-support/python2.4/turbogears/identity/saprovider.py",


line 119, in __init__
group_class = load_class(group_class_path)

File "/var/lib/python-support/python2.4/turbogears/util.py", line
295, in load_class


splitted_path = dottedpath.split('.')
AttributeError: 'NoneType' object has no attribute 'split'

what is weird is that it occurs only when i run unittests, in test.cfg
I have:

dentity.on=True
identity.provider="sqlalchemy"
identity.saprovider.model.user="globalconfui.model.User"
identity.saprovider.model.visit="globalconfui.model.VisitIdentity"
identity.saprovider.encryption_algorithm="sha1"

before upgrading to TG 1.0 last week the tests ran ok.
And through the browser identity works like a charm.

Jorge Vargas

unread,
Jan 19, 2007, 9:22:28 PM1/19/07
to turbo...@googlegroups.com
let me clarify that as long as you keep the 3 main object
(user,group,permission) and relationships between them, (like the one
karl pointed out you miss) the model will work.

but if you go deleting stuff without knowing what exactly gets call
you end up here.

On the other hand the current default identity the autogenerated and
the TG_*, are supposed to be the minimum requirement for *any* project
so IMO you should not need to delete anything, and if your thinking
"nah I don't need groups" then think about it as "i may some day needs
groups" :)

> Thanks,
> Suren
>
>
> >
>

Reply all
Reply to author
Forward
0 new messages