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

« back to all changes in this revision

Viewing changes to ivle/console.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:
36
36
 
37
37
class ConsoleError(Exception):
38
38
    """ The console failed in some way. This is bad. """
39
 
    def __init__(self, value):
40
 
        self.value = value
41
 
    def __str__(self):
42
 
        return repr(self.value)
 
39
    pass
43
40
 
44
41
class ConsoleException(Exception):
45
42
    """ The code being exectuted on the console returned an exception. 
46
43
    """
47
 
    def __init__(self, value):
48
 
        self.value = value
49
 
    def __str__(self):
50
 
        return repr(self.value)
 
44
    pass
51
45
 
52
46
class TruncateStringIO(StringIO.StringIO):
53
47
    """ A class that wraps around StringIO and truncates the buffer when the 
213
207
            # Couldn't decode the JSON
214
208
            raise ConsoleError(
215
209
                "Could not understand the python console response")
 
210
        except chat.ProtocolError, e:
 
211
            raise ConsoleError(*e.args)
216
212
 
217
213
        return response
218
214
 
297
293
              
298
294
        # Unpickle any exceptions
299
295
        if 'exception' in execute:
300
 
            return cPickle.loads(execute['exception'])
301
 
        else:
302
 
            return execute
 
296
            execute['exception'] = cPickle.loads(execute['exception'])
 
297
        return execute
303
298
 
304
299
 
305
300
    def set_vars(self, variables):