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

« back to all changes in this revision

Viewing changes to grackle/tests/test_client.py

  • Committer: Aaron Bentley
  • Date: 2012-01-13 14:04:36 UTC
  • mto: (6.1.30 trunk)
  • mto: This revision was merged to the branch mainline in revision 45.
  • Revision ID: aaron@canonical.com-20120113140436-vg1mmta8ub8o7vwr
Implement an archive namespace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    def do_GET(self):
83
83
        scheme, netloc, path, params, query_string, fragments = (
84
84
            urlparse(self.path))
85
 
        archive = os.path.split(path)[1]
 
85
        parts = path.split('/')
 
86
        if parts[1] == 'archive':
 
87
            self.get_messages(parts[2], query_string)
 
88
 
 
89
    def get_messages(self, archive_id, query_string):
86
90
        query = parse_qs(query_string)
87
91
        parameters = simplejson.loads(query['parameters'][0])
88
92
        order = parameters.get('order')
89
 
        messages = self.server.messages[archive]
 
93
        messages = self.server.messages[archive_id]
90
94
        if order is not None :
91
95
            if order not in SUPPORTED_ORDERS:
92
96
                self.send_response(httplib.BAD_REQUEST)