app/soc/views/models/host.py
changeset 998 125257161908
parent 990 fd1e6afb2d62
child 1007 3b66772d21a5
--- a/app/soc/views/models/host.py	Sun Jan 25 23:35:39 2009 +0000
+++ b/app/soc/views/models/host.py	Mon Jan 26 09:44:00 2009 +0000
@@ -42,9 +42,6 @@
 import soc.views.helper
 import soc.views.models.sponsor
 
-# TODO(pawel.solyga): Rename all list methods and functions to something else
-# and remove this tolist assignment
-tolist = list
 
 class View(role.View):
   """View methods for the Host model.
@@ -62,7 +59,7 @@
     rights['create'] = [access.checkIsHost]
     rights['edit'] = [access.checkIsMyActiveRole(soc.logic.models.host)]
     rights['invite'] = [access.checkIsHost]
-    rights['list'] = [access.checkIsHost]
+    rights['list'] = [access.checkIsDeveloper]
     rights['accept_invite'] = [access.checkCanCreateFromRequest('host')]
     rights['process_request'] = [access.checkIsHost,
         access.checkCanProcessRequest('host')]
@@ -96,6 +93,9 @@
 
     super(View, self).__init__(params=params)
 
+    # register the role with the group_view
+    params['group_view'].registerRole(params['module_name'], self)
+
     # create and store the special form for invited users
     updated_fields = {
         'link_id': forms.CharField(widget=widgets.ReadOnlyInput(),
@@ -107,28 +107,6 @@
 
     params['invited_create_form'] = invited_create_form
 
-
-  def list(self, request, access_type, page_name=None, 
-           params=None, filter=None):
-    """See base.View.list.
-
-    Passes a filter to base.View.list so that only hosts from a sponsor
-    that this user is host for are listed.
-    """
-
-    user = user_logic.logic.getForCurrentAccount()
-
-    # Don't bother looking up everything if there's no user
-    if user and (not accounts.isDeveloper(user=user)):
-      hosts = host_logic.logic.getForFields({'user': user})
-      sponsors = tolist((host.scope for host in hosts))
-
-      new_filter = {'scope': sponsors}
-      filter = dicts.merge(filter, new_filter)
-
-    return super(View, self).list(request, access_type, page_name=page_name,
-                                  params=params, filter=filter)
-
   def _editPost(self, request, entity, fields):
     """See base.View._editPost().
     """