Changeset 5039

Show
Ignore:
Timestamp:
07/25/08 04:32:34 (6 months ago)
Author:
splee
Message:

Updated identity model to use DBSession.mapper in the same way the TG1 models did.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/tg.devtools/trunk/devtools/templates/turbogears/+package+/model/identity.py_tmpl

    r5037 r5039  
    7373        based on their email addresses since it is unique. 
    7474        """ 
    75         session = DBSession() 
    76         return session.query(cls).filter(cls.email_address==email).first() 
     75        return cls.query.filter(cls.email_address==email).first() 
    7776 
    7877    @classmethod 
     
    8180        based on their user_name attribute. 
    8281        """ 
    83         session = DBSession() 
    84         return session.query(cls).filter(cls.user_name==username).first() 
     82        return cls.query.filter(cls.user_name==username).first() 
    8583 
    8684 
     
    154152 
    155153 
    156 mapper(User, users_table, 
     154DBSession.mapper(User, users_table, 
    157155        properties=dict(_password=users_table.c.password)) 
    158156 
    159 mapper(Group, groups_table, 
     157DBSession.mapper(Group, groups_table, 
    160158        properties=dict(users=relation(User, 
    161159                secondary=user_group_table, backref='groups'))) 
    162160 
    163 mapper(Permission, permissions_table, 
     161DBSession.mapper(Permission, permissions_table, 
    164162        properties=dict(groups=relation(Group, 
    165163                secondary=group_permission_table, backref='permissions')))