Hi everyone,
During work on my first Pylons site I was able to setup authkit to sign in
and sign out (not much for now I know ;)
I noticed that UsersFromDatabase supports only the most important user
properties (like username, password, role), and I was wondering what's the
right way to add additional ones (like i.e. email, account creation date and
so on).
I added option useexisting=True in 'users' table definition in authkit
source code. and then added definition for 'users' table in my model and
extended it with 'email' column with 'unique=True' enabled. It quickly
turned ou,t that's not a good idea, because authkit's user_create function
knows nothing about my email column which of course raises sqlalchemy
IntergrityError exception when creating a new user.
so my question is, what is the best way to store additional user data? maybe
I should add extra table and create one-to-one relationship with users table
created by authkit? Honestly I've tried that too. I added following in the
__init__.py in model directory:
user_extra_table = schema.Table('user_extra', meta.metadata,
schema.Column('id', types.Integer, primary_key=True),
schema.Column('user_id', types.Integer, schema.ForeignKey('users.uid')),
schema.Column("email", sa.types.Unicode(150), nullable=False,
unique=True)
)
orm.mapper(UserExtra, user_extra_table, properties={
'child': orm.relation(User, uselist=False, backref='extra')
})
But there's an error when relation is set up, because the User class is
unknown (not yet defined???)
I'll be grateful for any suggestions.
Best regards
C
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---