diff rhodecode/model/user.py @ 1693:60249224be04 beta

fix for api key lookup, reuse same function in user model
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 17 Nov 2011 18:52:48 +0200
parents 6944b1249f28
children 23bf79f4e8d4
line wrap: on
line diff
--- a/rhodecode/model/user.py	Thu Nov 17 18:33:44 2011 +0200
+++ b/rhodecode/model/user.py	Thu Nov 17 18:52:48 2011 +0200
@@ -70,13 +70,7 @@
         return user.scalar()
 
     def get_by_api_key(self, api_key, cache=False):
-
-        user = self.sa.query(User)\
-                .filter(User.api_key == api_key)
-        if cache:
-            user = user.options(FromCache("sql_cache_short",
-                                          "get_user_%s" % api_key))
-        return user.scalar()
+        return User.get_by_api_key(api_key, cache)
 
     def create(self, form_data):
         try: