~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/server/wsgi.py

  • Committer: William Grant
  • Date: 2012-01-22 06:41:06 UTC
  • Revision ID: william.grant@canonical.com-20120122064106-6at8ool919624m0z
Let the HTTP client decide count and order (to an extent).

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
            return self.index(name)
43
43
 
44
44
        if args.op == 'get_messages':
45
 
            return self.get_messages(name)
 
45
            return self.get_messages(name, args)
46
46
 
47
47
    def POST(self, name):
48
48
        data = web.data()
52
52
    def index(self, name):
53
53
        return ('Service for archive %s.' % name)
54
54
 
55
 
    def get_messages(self, name):
56
 
        return repr(conn.get_messages(name))
 
55
    def get_messages(self, name, args):
 
56
        try:
 
57
            count = int(args.count)
 
58
        except (AttributeError, ValueError):
 
59
            count = 10
 
60
        order = getattr(args, 'order', '-date')
 
61
        return repr(conn.get_messages(name, count=count, order=order))
57
62
 
58
63
 
59
64
urls = (