]> sipb.mit.edu Git - snippets/.git/blobdiff - TracZephyrPlugin/ZephyrPlugin.py
TracZephyrPlugin: Permit using a custom command (e.g. zcrypt)
[snippets/.git] / TracZephyrPlugin / ZephyrPlugin.py
index 320658e2632dabc900d749a3732b26cbdb2aab73..ad9186582125f96d693ca119e12715bc3203f358 100644 (file)
@@ -10,16 +10,21 @@ class ZephyrPlugin(Component):
         zclass = self.config.get('ZephyrPlugin', 'class')
         if zclass == '':
             return
-        p = subprocess.Popen(['zwrite', '-q', '-l', '-d',
+        command = self.config.get('ZephyrPlugin', 'command')
+        if not command:
+            command = 'zwrite'
+        p = subprocess.Popen([command, '-q', '-l', '-d',
                               '-c', zclass,
                               '-i', 'trac-#%s' % id],
                              stdin=subprocess.PIPE)
-        p.stdin.write("\n".join(textwrap.wrap(message)).encode('utf-8', 'replace'))
+        p.stdin.write(message.encode('utf-8', 'replace'))
         p.stdin.close()
         p.wait()
     
     def ticket_created(self, ticket):
-        message = "%s filed a new ticket:\n%s\n\n%s" % (ticket['reporter'], ticket['summary'], ticket['description'][:255])
+        message = "%s filed a new ticket:\n%s\n\n%s" % (ticket['reporter'],
+                                                        ticket['summary'],
+                                                        textwrap.fill(ticket['description'][:255]))
         self.zwrite(ticket.id, message)
     
     def ticket_changed(self, ticket, comment, author, old_values):