示例#1
0
文件: locations.py 项目: p/midge
 def handle_get(self, session_id, values, wfile):
     user = self.application.get_user(session_id)
     if user:
         status = values.pop("status", None)
         sort_by = values.pop("sort_by", None)
         order = values.pop("order", None)
         show_method_name = "_show_%s" % status
         if hasattr(self, show_method_name):
             show_method = getattr(self, show_method_name)
             templates.header(wfile)
             show_method(session_id, wfile, sort_by, order)
             templates.footer(wfile)
         else:
             templates.header(wfile)
             templates.title(wfile, "List bugs")
             templates.bullets(
                 wfile,
                 'Each bug list is designed for a particular objective.',
                 'Use the <a href="/search">Search bugs</a> page '
                 'for hand-crafted listings.')
             status_counts = self.application.get_status_counts(session_id)
             templates.list_form(wfile, self.path, status_counts)
             templates.footer(wfile)
     else:
         values["next"] = self.path
         path = lib.join_url(Login.path, values)
         self.redirect(path)
示例#2
0
文件: templates_test.py 项目: p/midge
 def test_list_form(self):
     """Check list form"""
     class MockStatusCounts:
         new = 3
         reviewed = 45
         scheduled = 12
         fixed = 0
         closed = 4534
     
     wfile = self.get_wfile()
     wfile.write("<test>\n")
     templates.list_form(wfile, "a path", MockStatusCounts())
     wfile.write("</test>")
     self.assert_(self.is_well_formed(wfile))