Merge lp:~splee/turbogearshub/spleedev into lp:turbogearshub

Proposed by Lee McFadden
Status: Merged
Approved by: Gustavo Narea
Approved revision: 34
Merged at revision: 35
Proposed branch: lp:~splee/turbogearshub/spleedev
Merge into: lp:turbogearshub
Diff against target: None lines
To merge this branch: bzr merge lp:~splee/turbogearshub/spleedev
Reviewer Review Type Date Requested Status
Gustavo Narea Approve
Review via email: mp+4152@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lee McFadden (splee) wrote :

DeclarativeBase now uses DBSession.mapper instead of the default mapper function.

This allows for ModelClass.query instead of DBSession.query(ModelClass)

Revision history for this message
Gustavo Narea (gnarea) wrote :

Looks good. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/tghub/model/__init__.py'
2--- app/tghub/model/__init__.py 2009-02-21 01:08:31 +0000
3+++ app/tghub/model/__init__.py 2009-03-04 18:05:09 +0000
4@@ -32,7 +32,7 @@
5 DBSession = scoped_session(_maker)
6
7 # Creating the base class for the models:
8-DeclarativeBase = declarative_base()
9+DeclarativeBase = declarative_base(mapper=DBSession.mapper)
10
11 # The global metadata:
12 metadata = DeclarativeBase.metadata
13
14=== modified file 'app/tghub/model/auth.py'
15--- app/tghub/model/auth.py 2009-02-21 01:16:54 +0000
16+++ app/tghub/model/auth.py 2009-03-04 18:05:09 +0000
17@@ -124,12 +124,12 @@
18 @classmethod
19 def by_email_address(cls, email):
20 """Search users based on their email addresses."""
21- return DBSession.query(cls).filter(cls.email_address==email).first()
22+ return cls.query.filter(cls.email_address==email).first()
23
24 @classmethod
25 def by_user_name(cls, username):
26 """Search users based on their user name."""
27- return DBSession.query(cls).filter(cls.user_name==username).first()
28+ return cls.query.filter(cls.user_name==username).first()
29
30
31 def _set_password(self, password):

Subscribers

People subscribed via source and target branches

to all changes: