Am 18.02.2011 08:53 schrieb Abdul Gaffar:
I tried the following example, rows are inserting fine but when  I try
to login I am getting the following error.

InvalidRequestError: Mapper 'Mapper|User|t_user' has no property
'groups'

That's because the TG authentication system tries to determine the groups the user is a member of. If you want to give him the rights for all projects, you can define it like this:

class User(DeclarativeBase):
    ...
    groups = relationship('Group', secondary='t_assoc')

Or, maybe you first want to select a project and store it in the session, then you can define it like that:

class User(DeclarativeBase):
    ...
    def groups_for_project_id(self, project_id):
        return Group.query.join(Association).filter_by(
            project_id=project_id, user_id=self.user_id).all()
    @property
    def groups(self):
        return self.groups_for_project_id(
            beakersession.get('project_id'))

It all depends on what you need.

-- Christoph

--
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to