Skip to content
Browse files

Reuse `SQLAlchemyORMContext.get_member()` in other member methods.

`update_member()` and `delete_member()` used the same query as `get_member()` to fetch a member from the database. For obvious reasons, they should call `get_member()` instead.
  • Loading branch information...
1 parent 6d402a9 commit 67ecf062d9b28eeb64ad37561e8958be3fece6bf @wylee committed Jan 26, 2012
Showing with 2 additions and 4 deletions.
  1. +2 −4 pyramid_restler/model.py
View
6 pyramid_restler/model.py
@@ -117,8 +117,7 @@ def create_member(self, data):
return member
def update_member(self, id, data):
- q = self.session.query(self.entity)
- member = q.get(id)
+ member = self.get_member(id)
if member is None:
return None
for name in data:
@@ -127,8 +126,7 @@ def update_member(self, id, data):
return member
def delete_member(self, id):
- q = self.session.query(self.entity)
- member = q.get(id)
+ member = self.get_member(id)
if member is None:
return None
self.session.delete(member)

0 comments on commit 67ecf06

Please sign in to comment.
Something went wrong with that request. Please try again.