]> andersk Git - zcommit.git/blobdiff - zcommit.py
Unicode support.
[zcommit.git] / zcommit.py
index ff08df14c54401208ffa024e09fc82d03c2c09be..1f37853ba64505d82fe36dea7d8dc0709b49a7de 100755 (executable)
@@ -35,7 +35,7 @@ msg: %(msg)s""" % {'sender' : sender,
                    'msg' : msg})
     cmd = [ZWRITE, '-S', sender, '-c', klass, '-i', instance,
            '-s', zsig, '-d', '-m', msg]
-    subprocess.check_call(cmd)
+    subprocess.check_call([p.encode('utf-8') for p in cmd])
 
 class Application(object):
     @cherrypy.expose
@@ -59,7 +59,9 @@ is parsed as having type <tt>github</tt>, class <tt>zcommit</tt>, and
 instance <tt>commit</tt>.  Using this information, zcommit figures out
 how to form a useful message which is then sends as a zephyr.
 
-<h1> Github </h1>
+<h1> Types </h1>
+
+<h2> Github </h2>
 
 Set your POST-back URL to
 <tt>http://zcommit.mit.edu/github/class/$classname</tt>, followed by
@@ -67,7 +69,7 @@ any of the following optional key/value parameters:
 
 <ul>
 <li> <tt>/instance/$instance</tt> </li>
-<li> <tt>/zsig/$zsig</tt> </li>
+<li> <tt>/zsig/$zsig</tt> (sets the prefix of the zsig; the postfix is always the branch name) </li>
 <li> <tt>/sender/$sender</tt> </li>
 </ul>
 """
@@ -89,7 +91,7 @@ any of the following optional key/value parameters:
                 raise cherrypy.HTTPError(400, 'Invalid submission URL')
             logger.debug('Passed validation')
             for i in xrange(0, len(args), 2):
-                opts[args[i]] = args[i + 1]
+                opts[args[i]] = unicode(args[i + 1], 'utf-8', 'replace')
             logger.debug('Set opts')
             if 'class' not in opts:
                 raise cherrypy.HTTPError(400, 'Must specify a zephyr class name')
@@ -103,7 +105,7 @@ any of the following optional key/value parameters:
                     zsig = '%s: %s' % (opts['zsig'], zsig)
                 sender = opts.get('sender', 'daemon.zcommit')
                 logger.debug('Set zsig')
-                for c in reversed(payload['commits']):
+                for c in payload['commits']:
                     inst = opts.get('instance', c['id'][:8])
                     actions = []
                     if c.get('added'):
@@ -118,9 +120,11 @@ any of the following optional key/value parameters:
                             'email' : c['author']['email'],
                             'message' : c['message'],
                             'timestamp' : c['timestamp'],
-                            'actions' : '--\n'.join(actions)}
+                            'actions' : '--\n'.join(actions),
+                            'url' : c['url']}
                     
                     msg = """%(name)s <%(email)s> (%(timestamp)s)
+%(url)s
 > %(message)s
 --
 %(actions)s""" % info
This page took 0.044434 seconds and 4 git commands to generate.