We add a new type of Vumi Go message, similar to a VumiApiCommand to handle events:
VumiApiEvent:
account_key
conversation_key
conversation_type
event_type
event_data
| 2011-07-23 00:37:42+0200 [Vas2NetsTransport,client] Unhandled error in Deferred: | |
| 2011-07-23 00:37:42+0200 [Vas2NetsTransport,client] Unhandled Error | |
| Traceback (most recent call last): | |
| File "/Users/jerith/code/vumi-campaigns/ve/lib/python2.6/site-packages/twisted/internet/defer.py", line 823, in _inlineCallbacks | |
| result = g.send(result) | |
| File "/Users/jerith/code/vumi/vumi/service.py", line 217, in consume | |
| message.content.body)) | |
| File "/Users/jerith/code/vumi/vumi/service.py", line 247, in consume_message | |
| return self.callback(message) | |
| File "/Users/jerith/code/vumi-campaigns/ve/lib/python2.6/site-packages/twisted/internet/defer.py", line 944, in unwindGenerator |
| ;; Should this be more general? | |
| (defun highlight-tabs () | |
| "Make tabs show up in the same color as trailing whitespace." | |
| (font-lock-add-keywords nil '(("\t" 0 'trailing-whitespace prepend)))) | |
| (require 'python) ; Because Aquamacs likes python-mode.el and I don't. | |
| ;; (require 'ipython) ; Uses python-mode.el :-( | |
| (add-hook 'python-mode-hook 'highlight-tabs) | |
| (add-hook 'python-mode-hook (lambda () |
| def parse_8601(timestr): | |
| """Parse an ISO-8601 timestamp. | |
| :param timestr: String containing an ISO-8601 timestamp. | |
| :returns: Python :class:`~datetime.datetime` instance. | |
| This only parses a common subset of the standard, but Python's | |
| standard library (as of 2.5, at least) does not have a suitable | |
| parser and we may not want to depend on thrid-party libraries | |
| everywhere this is used. |
| #!/usr/bin/env python | |
| from bs4 import BeautifulSoup | |
| INDEX_FILE = 'index.html' | |
| SCRIPT_FILE = 'get_games.sh' | |
| soup = BeautifulSoup(open(INDEX_FILE).read()) |
| class Toy(object): | |
| def handle_input(self, text): | |
| command, rest = (text.split(None, 1) + [''])[:2] | |
| return getattr(self, 'cmd_' + command, self.unknown_command)(command, rest) | |
| def cmd_foo(self, command, rest): | |
| print "Foo! %s" % (rest,) | |
| def cmd_rev(self, command, rest): | |
| print ''.join(reversed(rest)) |
| (vumicampaigns)lantea:vumi-campaigns jerith$ pip freeze | |
| PyYAML==3.10 | |
| Twisted==12.0.0 | |
| iso8601==0.1.4 | |
| meld3==0.6.8 | |
| nltk==2.0.1rc4 | |
| oauth==1.0.1 | |
| pep8==1.0.1 | |
| protobuf==2.4.1 | |
| psycopg2==2.4.1 |
| #!/bin/bash | |
| # You may need to replace "jot" with "seq" if you're on Linux instead of OSX. | |
| # Also, you may need to find a replacement for "uuidgen" if you don't have it. | |
| function setprops() { | |
| for i in `jot 10`; do | |
| name="test=`uuidgen`" | |
| curl -v -X PUT -H "Content-Type: application/json" \ | |
| -d '{"props":{"n_val":5}}' http://127.0.0.1:8098/riak/$name \ |
| lantea:vumi jerith$ ./ve/bin/pep8 vumi | sed -e 's/[^ ]* //' | sort | uniq -c | |
| 5 E121 continuation line indentation is not a multiple of four | |
| 3 E122 continuation line missing indentation or outdented | |
| 306 E123 closing bracket does not match indentation of opening bracket's line | |
| 10 E124 closing bracket does not match visual indentation | |
| 10 E125 continuation line does not distinguish itself from next logical line | |
| 222 E126 continuation line over-indented for hanging indent | |
| 86 E127 continuation line over-indented for visual indent | |
| 181 E128 continuation line under-indented for visual indent | |
| 1 E501 line too long (88 > 79 characters) |
| XML: | |
| <?xml version="1.0"?> | |
| <carrot xmlns:jr="http://openrosa.org/javarosa"> | |
| <jr:foo> | |
| <bar>one<baz><bar>fraction</bar></baz></bar> | |
| <bar>two</bar> | |
| <bar>three</bar> | |
| </jr:foo> | |
| </carrot> |