Merge branch 'main' into avm99963-monorail

Merged commit 3779da353b36d43cf778e7d4f468097714dd4540

GitOrigin-RevId: 6451a5c6b75afb0fd1f37b3f14521148d0722ea8
diff --git a/sitewide/groupadmin.py b/sitewide/groupadmin.py
index 3e8bcce..09593e0 100644
--- a/sitewide/groupadmin.py
+++ b/sitewide/groupadmin.py
@@ -23,7 +23,7 @@
 from sitewide import group_helpers
 
 
-class GroupAdmin(servlet.Servlet):
+class GroupAdmin(flaskservlet.FlaskServlet):
   """The group admin page."""
 
   _PAGE_TEMPLATE = 'sitewide/group-admin-page.ezt'
@@ -123,8 +123,8 @@
           mr, '/g/%s%s' % (group_name, urls.GROUP_ADMIN),
           include_project=False, saved=1, ts=int(time.time()))
 
-  # def GetGroupAdmin(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetGroupAdmin(self, **kwargs):
+    return self.handler(**kwargs)
 
-  # def PostGroupAdmin(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def PostGroupAdmin(self, **kwargs):
+    return self.handler(**kwargs)
diff --git a/sitewide/groupcreate.py b/sitewide/groupcreate.py
index ce0f151..2c0ece7 100644
--- a/sitewide/groupcreate.py
+++ b/sitewide/groupcreate.py
@@ -14,12 +14,11 @@
 from framework import exceptions, flaskservlet
 from framework import framework_helpers
 from framework import permissions
-from framework import servlet
 from proto import usergroup_pb2
 from sitewide import group_helpers
 
 
-class GroupCreate(servlet.Servlet):
+class GroupCreate(flaskservlet.FlaskServlet):
   """Shows a page with a simple form to create a user group."""
 
   _PAGE_TEMPLATE = 'sitewide/group-create-page.ezt'
@@ -103,8 +102,8 @@
       return framework_helpers.FormatAbsoluteURL(
           mr, '/g/%s/' % group_id, include_project=False)
 
-  # def GetGroupCreate(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetGroupCreate(self, **kwargs):
+    return self.handler(**kwargs)
 
-  # def PostGroupCreate(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def PostGroupCreate(self, **kwargs):
+    return self.handler(**kwargs)
diff --git a/sitewide/groupdetail.py b/sitewide/groupdetail.py
index 4428a53..1f16a0a 100644
--- a/sitewide/groupdetail.py
+++ b/sitewide/groupdetail.py
@@ -28,7 +28,7 @@
 MEMBERS_PER_PAGE = 50
 
 
-class GroupDetail(servlet.Servlet):
+class GroupDetail(flaskservlet.FlaskServlet):
   """The group detail page presents information about one user group."""
 
   _PAGE_TEMPLATE = 'sitewide/group-detail-page.ezt'
@@ -189,9 +189,7 @@
       String URL to redirect the user to after processing.
     """
     # 1. Gather data from the request.
-    remove_strs = post_data.getall('remove')
-    # TODO(crbug.com/monorail/10936): getall in Flask is getlist
-    # remove_strs = post_data.getlist('remove')
+    remove_strs = post_data.getlist('remove')
     logging.info('remove_strs = %r', remove_strs)
 
     if not remove_strs:
@@ -212,8 +210,8 @@
           mr, '/g/%s/' % mr.viewed_username, include_project=False,
           saved=1, ts=int(time.time()))
 
-  # def GetGroupDetail(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetGroupDetail(self, **kwargs):
+    return self.handler(**kwargs)
 
-  # def PostGroupDetail(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def PostGroupDetail(self, **kwargs):
+    return self.handler(**kwargs)
diff --git a/sitewide/grouplist.py b/sitewide/grouplist.py
index 57c46e9..627ca22 100644
--- a/sitewide/grouplist.py
+++ b/sitewide/grouplist.py
@@ -86,14 +86,14 @@
   #   return self.handler(**kwargs)
 
 
-class GroupDelete(flaskservlet.FlaskServlet):
+class FlaskGroupList(flaskservlet.FlaskServlet):
   """Shows a page with a simple form to create a user group."""
 
   _PAGE_TEMPLATE = 'sitewide/group-list-page.ezt'
 
   def AssertBasePermission(self, mr):
     """Assert that the user has the permissions needed to view this page."""
-    super(GroupDelete, self).AssertBasePermission(mr)
+    super(FlaskGroupList, self).AssertBasePermission(mr)
 
     if not mr.perms.HasPerm(permissions.VIEW_GROUP, None, None):
       raise permissions.PermissionException(
@@ -150,3 +150,6 @@
 
   def PostGroupDelete(self, **kwargs):
     return self.handler(**kwargs)
+
+  def GetGroupList(self, **kwargs):
+    return self.handler(**kwargs)
diff --git a/sitewide/moved.py b/sitewide/moved.py
index 968422c..8c2935f 100644
--- a/sitewide/moved.py
+++ b/sitewide/moved.py
@@ -20,7 +20,7 @@
 from project import project_constants
 
 
-class ProjectMoved(servlet.Servlet):
+class ProjectMoved(flaskservlet.FlaskServlet):
   """The ProjectMoved page explains that the project has moved."""
 
   _PAGE_TEMPLATE = 'sitewide/moved-page.ezt'
@@ -61,5 +61,5 @@
         'moved_to_url': moved_to_url,
         }
 
-  # def GetProjectMoved(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetProjectMoved(self, **kwargs):
+    return self.handler(**kwargs)
diff --git a/sitewide/projectcreate.py b/sitewide/projectcreate.py
index c3f8cca..37d02c8 100644
--- a/sitewide/projectcreate.py
+++ b/sitewide/projectcreate.py
@@ -37,7 +37,7 @@
 _MSG_MISSING_PROJECT_SUMMARY = 'Missing project summary'
 
 
-class ProjectCreate(servlet.Servlet):
+class ProjectCreate(flaskservlet.FlaskServlet):
   """Shows a page with a simple form to create a project."""
 
   _PAGE_TEMPLATE = 'sitewide/project-create-page.ezt'
@@ -156,8 +156,8 @@
       return framework_helpers.FormatAbsoluteURL(
           mr, urls.ADMIN_INTRO, project_name=project_name)
 
-  # def GetCreateProject(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetCreateProject(self, **kwargs):
+    return self.handler(**kwargs)
 
-  # def PostCreateProject(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def PostCreateProject(self, **kwargs):
+    return self.handler(**kwargs)
diff --git a/sitewide/test/groupadmin_test.py b/sitewide/test/groupadmin_test.py
index d1f7e0f..72dfa9d 100644
--- a/sitewide/test/groupadmin_test.py
+++ b/sitewide/test/groupadmin_test.py
@@ -34,8 +34,7 @@
     self.services.usergroup.TestAddGroupSettings(888, 'group@example.com')
     self.services.usergroup.TestAddGroupSettings(
         999, 'importgroup@example.com', external_group_type='mdb')
-    self.servlet = groupadmin.GroupAdmin(
-        'req', 'res', services=self.services)
+    self.servlet = groupadmin.GroupAdmin(services=self.services)
     self.mr = testing_helpers.MakeMonorailRequest()
     self.mr.viewed_username = 'group@example.com'
     self.mr.viewed_user_auth.user_id = 888
diff --git a/sitewide/test/groupcreate_test.py b/sitewide/test/groupcreate_test.py
index bf7be8d..f82fb74 100644
--- a/sitewide/test/groupcreate_test.py
+++ b/sitewide/test/groupcreate_test.py
@@ -28,8 +28,7 @@
         user=fake.UserService(),
         usergroup=fake.UserGroupService(),
         project=fake.ProjectService())
-    self.servlet = groupcreate.GroupCreate(
-        'req', 'res', services=self.services)
+    self.servlet = groupcreate.GroupCreate(services=self.services)
     self.mr = testing_helpers.MakeMonorailRequest()
 
   def CheckAssertBasePermissions(
diff --git a/sitewide/test/groupdetail_test.py b/sitewide/test/groupdetail_test.py
index 4440bb8..f294606 100644
--- a/sitewide/test/groupdetail_test.py
+++ b/sitewide/test/groupdetail_test.py
@@ -31,8 +31,7 @@
     self.services.user.TestAddUser('c@example.com', 333)
     self.services.user.TestAddUser('group@example.com', 888)
     self.services.usergroup.TestAddGroupSettings(888, 'group@example.com')
-    self.servlet = groupdetail.GroupDetail(
-        'req', 'res', services=self.services)
+    self.servlet = groupdetail.GroupDetail(services=self.services)
     self.mr = testing_helpers.MakeMonorailRequest()
     self.mr.viewed_username = 'group@example.com'
     self.mr.viewed_user_auth.user_id = 888
@@ -142,5 +141,3 @@
     self.assertRaises(
         exceptions.NoSuchGroupException,
         self.servlet.GatherPageData, self.mr)
-
-
diff --git a/sitewide/test/moved_test.py b/sitewide/test/moved_test.py
index 04b9165..eccb195 100644
--- a/sitewide/test/moved_test.py
+++ b/sitewide/test/moved_test.py
@@ -24,7 +24,7 @@
   def setUp(self):
     self.services = service_manager.Services(
         project=fake.ProjectService())
-    self.servlet = moved.ProjectMoved('req', 'res', services=self.services)
+    self.servlet = moved.ProjectMoved(services=self.services)
     self.old_project = 'old-project'
 
   def testGatherPageData_NoProjectSpecified(self):
@@ -40,7 +40,7 @@
     _, mr = testing_helpers.GetRequestObjects(
         path='/hosting/moved?project=nonexistent')
 
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
     self.assertEqual(404, cm.exception.code)
 
@@ -50,7 +50,7 @@
     _, mr = testing_helpers.GetRequestObjects(
         path='/hosting/moved?project=%s' % self.old_project)
 
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
     self.assertEqual(400, cm.exception.code)
 
diff --git a/sitewide/test/projectcreate_test.py b/sitewide/test/projectcreate_test.py
index 8f468dd..13dc97b 100644
--- a/sitewide/test/projectcreate_test.py
+++ b/sitewide/test/projectcreate_test.py
@@ -24,7 +24,7 @@
 
   def setUp(self):
     services = service_manager.Services()
-    self.servlet = projectcreate.ProjectCreate('req', 'res', services=services)
+    self.servlet = projectcreate.ProjectCreate(services=services)
 
   def CheckAssertBasePermissions(
       self, restriction, expect_admin_ok, expect_nonadmin_ok):
diff --git a/sitewide/test/usersettings_test.py b/sitewide/test/usersettings_test.py
index 54c14ae..dd7d252 100644
--- a/sitewide/test/usersettings_test.py
+++ b/sitewide/test/usersettings_test.py
@@ -10,7 +10,10 @@
 
 import unittest
 
-import mox
+try:
+  from mox3 import mox
+except ImportError:
+  import mox
 
 from framework import framework_helpers
 from framework import permissions
@@ -27,8 +30,7 @@
   def setUp(self):
     self.mox = mox.Mox()
     self.services = service_manager.Services(user=fake.UserService())
-    self.servlet = usersettings.UserSettings(
-        'req', 'res', services=self.services)
+    self.servlet = usersettings.UserSettings(services=self.services)
 
   def tearDown(self):
     self.mox.UnsetStubs()
diff --git a/sitewide/test/userupdates_test.py b/sitewide/test/userupdates_test.py
index efae9bc..725b123 100644
--- a/sitewide/test/userupdates_test.py
+++ b/sitewide/test/userupdates_test.py
@@ -10,7 +10,10 @@
 
 import unittest
 
-import mox
+try:
+  from mox3 import mox
+except ImportError:
+  import mox
 
 from features import activities
 from services import service_manager
@@ -112,4 +115,3 @@
     self.assertEqual('st5', page_data['user_tab_mode'])
     self.assertEqual('yes', page_data['viewing_user_page'])
     self.assertEqual(uui._TAB_MODE, page_data['user_updates_tab_mode'])
-
diff --git a/sitewide/usersettings.py b/sitewide/usersettings.py
index 8484afc..163d731 100644
--- a/sitewide/usersettings.py
+++ b/sitewide/usersettings.py
@@ -14,14 +14,14 @@
 import ezt
 
 from businesslogic import work_env
+from framework import flaskservlet
 from framework import framework_helpers
 from framework import permissions
-from framework import servlet
 from framework import template_helpers
 from framework import urls
 
 
-class UserSettings(servlet.Servlet):
+class UserSettings(flaskservlet.FlaskServlet):
   """Shows a page with a simple form to edit user preferences."""
 
   _PAGE_TEMPLATE = 'sitewide/user-settings-page.ezt'
@@ -66,10 +66,8 @@
 
   # pylint: disable=unused-argument
   def GetUserSetting(self, **kwargs):
-    return
-    # return self.handler(**kwargs)
+    return self.handler(**kwargs)
 
   # pylint: disable=unused-argument
   def PostUserSetting(self, **kwargs):
-    return
-    # return self.handler(**kwargs)
+    return self.handler(**kwargs)