Henrique Romano avatar Henrique Romano committed e054cb7

implement support for sending ticket processing result to the ticket's page.

Comments (0)

Files changed (2)


         if not config.get("send_report"):
             print ticket.get_report()
-            # TODO: send report to the ticket's page
-            pass
+            ticket.send_report(config)
 def try_ticket(config):
     func = lambda ticket, wc, limit: \


     def __init__(self, ticket_id):
         self._ticket_id = int(ticket_id)
         self.__patches = []
-        self._reporter = Reporter("Ticket #%d" % self._ticket_id)
+        self._reporter = Reporter()
+        self._reporter.info("=== REPORT FOR TICKET #%d ===" % self._ticket_id)
+    def send_report(self, config):
+        """Send the generated report to a ticket's comment."""
+        proxy = get_proxy(config.get("trac"))
+        proxy.ticket.update(
+            self._ticket_id, ("""
+'''This ticket has been checked through django-triager-bot, below is the
+}}}""" % self.get_report()))
     def get_report(self):
         """Print the report generated so far.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.