X-Git-Url: https://snippets.scripts.mit.edu/gitweb.cgi/.git/blobdiff_plain/da9785cf7270af56d3f66410e7f895ea353f220a..0e5f06a195f44b9f8c33cb9d2efdb4773c3d82b7:/TracZephyrPlugin/ZephyrPlugin.py diff --git a/TracZephyrPlugin/ZephyrPlugin.py b/TracZephyrPlugin/ZephyrPlugin.py index ad91865..0f40125 100644 --- a/TracZephyrPlugin/ZephyrPlugin.py +++ b/TracZephyrPlugin/ZephyrPlugin.py @@ -2,6 +2,7 @@ from trac.core import * from trac.ticket import ITicketChangeListener import subprocess import textwrap +import shlex class ZephyrPlugin(Component): implements(ITicketChangeListener) @@ -10,14 +11,14 @@ class ZephyrPlugin(Component): zclass = self.config.get('ZephyrPlugin', 'class') if zclass == '': return - command = self.config.get('ZephyrPlugin', 'command') + command = shlex.split(self.config.get('ZephyrPlugin', 'command')) if not command: - command = 'zwrite' - p = subprocess.Popen([command, '-q', '-l', '-d', - '-c', zclass, + command = ['zwrite', '-q', '-l', '-d'] + p = subprocess.Popen(command + + ['-c', zclass, '-i', 'trac-#%s' % id], stdin=subprocess.PIPE) - p.stdin.write(message.encode('utf-8', 'replace')) + p.stdin.write(message.replace('@', '@@').encode('utf-8', 'replace')) p.stdin.close() p.wait()