Take advantage of new "from ... import ... as ..." rules in the style guide.
authorTodd Larsen <tlarsen@google.com>
Wed, 21 Jan 2009 21:09:52 +0000
changeset 887 b8c1a6bc913e
parent 886 f5847f24c56e
child 888 a75ae24f04cb
Take advantage of new "from ... import ... as ..." rules in the style guide. Patch by: Todd Larsen Review by: to-be-reviewed
app/soc/views/helper/access.py
--- a/app/soc/views/helper/access.py	Wed Jan 21 20:25:07 2009 +0000
+++ b/app/soc/views/helper/access.py	Wed Jan 21 21:09:52 2009 +0000
@@ -38,10 +38,10 @@
 
 from soc.logic import accounts
 from soc.logic import dicts
-from soc.logic.models import host as host_logic
-from soc.logic.models import notification as notification_logic
-from soc.logic.models import user as user_logic
-from soc.logic.models import request as request_logic
+from soc.logic.models.host import logic as host_logic
+from soc.logic.models.notification import logic as notification_logic
+from soc.logic.models.request import logic as request_logic
+from soc.logic.models.user import logic as user_logic
 from soc.views import helper
 from soc.views import out_of_band
 
@@ -186,8 +186,8 @@
 
   checkIsLoggedIn(request, args, kwargs)
 
-  user = user_logic.logic.getForFields(
-      {'account': users.get_current_user()}, unique=True)
+  user = user_logic.getForFields({'account': users.get_current_user()},
+                                 unique=True)
 
   if user:
     return
@@ -246,11 +246,10 @@
 
   checkIsUser(request, args, kwargs)
 
-  user = user_logic.logic.getForFields(
-      {'account': users.get_current_user()}, unique=True)
+  user = user_logic.getForFields({'account': users.get_current_user()},
+                                 unique=True)
 
-  host = host_logic.logic.getForFields(
-      {'user': user}, unique=True)
+  host = host_logic.getForFields({'user': user}, unique=True)
 
   if host:
     return
@@ -333,8 +332,8 @@
   group_id = splitpath[2]
   user_id = splitpath[3]
 
-  user = user_logic.logic.getForFields(
-      {'account': users.get_current_user()}, unique=True)
+  user = user_logic.getForFields({'account': users.get_current_user()},
+                                 unique=True)
 
   if user_id != user.link_id:
     # TODO: perhaps this needs a better explanation?
@@ -347,7 +346,7 @@
       'group_accepted': True,
       }
 
-  request = request_logic.logic.getForFields(properties, unique=True)
+  request = request_logic.getForFields(properties, unique=True)
 
   if request:
     return
@@ -381,7 +380,7 @@
 
     checkIsUser(request, args, kwargs)
 
-    user = user_logic.logic.getForCurrentAccount()
+    user = user_logic.getForCurrentAccount()
 
     properties = {
         'applicant': user,
@@ -432,8 +431,8 @@
 
   properties = dicts.filter(kwargs, ['link_id', 'scope_path'])
 
-  notification = notification_logic.logic.getForFields(properties, unique=True)
-  user = user_logic.logic.getForCurrentAccount()
+  notification = notification_logic.getForFields(properties, unique=True)
+  user = user_logic.getForCurrentAccount()
 
   # We need to check to see if the key's are equal since the User
   # objects are different and the default __eq__ method does not check
@@ -476,7 +475,7 @@
     if not application:
       deny(request, args, kwargs)
     
-    user = user_logic.logic.getForCurrentAccount()
+    user = user_logic.getForCurrentAccount()
 
     # We need to check to see if the key's are equal since the User
     # objects are different and the default __eq__ method does not check