示例#1
0
文件: locations.py 项目: p/midge
 def _report_on_changes(self, session_id, old_bug, changes, wfile):
     new_bug = self.application.get_bug(session_id, old_bug.bug_id)
     if changes:
         templates.title(wfile, "Bug update successful")
         bullet_items = []
         if changes.pop("comment", None):
             bullet_items.append("Added new comment.")
         for variable, new_value in changes.iteritems():
             old_value = getattr(old_bug, variable)
             variable = variable.capitalize().replace("_", " ")
             if old_value and new_value:
                 bullet_items.append('Changed "%s" from %s to %s.' % \
                                     (variable, old_value, new_value))
             else:
                 if old_value:
                     bullet_items.append('Unset "%s".' % variable)
                 else:
                     bullet_items.append('Set "%s" to %s.' % \
                                         (variable, new_value))
         templates.bullets(wfile, *bullet_items)
     else:
         templates.title(wfile, "No update needed")
     templates.hrule(wfile)
     templates.title(wfile, new_bug.title)
     self._show_status_and_comments_and_form(wfile, new_bug)
示例#2
0
文件: locations.py 项目: p/midge
 def _show_status_and_comments_and_form(self, wfile, bug):
     templates.bug_status_summary(wfile, bug)
     templates.vspace(wfile)
     templates.show_comments(wfile, bug)
     templates.hrule(wfile)
     templates.edit_bug_form(
         wfile, self.path, bug,
         self.application.statuses,
         self.application.priorities,
         self.application.resolutions,
         self.application.categories,
         self.application.keywords,
         self.application.versions)
示例#3
0
文件: templates_test.py 项目: p/midge
 def test_hrule(self):
     """Check hrule"""
     wfile = self.get_wfile()
     templates.hrule(wfile)
     self.assert_(self.is_well_formed(wfile))