~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/console/service.py

  • Committer: William Grant
  • Date: 2010-02-25 07:34:50 UTC
  • Revision ID: grantw@unimelb.edu.au-20100225073450-zcl8ev5hlyhbszeu
Activate the Storm C extensions if possible. Moar speed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
# XXX: Should be RPC view, with actions in URL?
38
38
class ConsoleServiceRESTView(JSONRESTView):
39
39
    '''An RPC interface to a Python console.'''
40
 
    def get_permissions(self, user):
 
40
    def get_permissions(self, user, config):
41
41
        if user is not None:
42
42
            return set(['use'])
43
43
        else:
87
87
 
88
88
        msg = {'cmd':kind, 'text':text}
89
89
        try:
90
 
            json_response = ivle.chat.chat(host, port, msg, magic,decode=False)
91
 
 
92
 
            # Snoop the response from python-console to check that it's valid
93
90
            try:
 
91
                json_response = ivle.chat.chat(host, port, msg, magic,decode=False)
 
92
                # Snoop the response from python-console to check that it's valid
94
93
                response = cjson.decode(json_response)
95
 
            except cjson.DecodeError:
 
94
            except (cjson.DecodeError, ivle.chat.ProtocolError):
96
95
                # Could not decode the reply from the python-console server
97
96
                response = {"terminate":
98
97
                    "Communication to console process lost"}