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

« back to all changes in this revision

Viewing changes to services/python-console

  • Committer: matt.giuca
  • Date: 2009-01-12 00:34:59 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1073
usrmgt-server: When creating svn repo, now explicitly asks for the exception
    to be thrown up, rather than ignored.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
import traceback
17
17
from threading import Thread
18
18
 
19
 
import ivle.chat
20
 
import ivle.util
 
19
import common.chat
 
20
import common.util
21
21
 
22
22
# This version must be supported by both the local and remote code
23
23
PICKLEVERSION = 0
67
67
        '''Trim an incomplete UTF-8 character from the end of a string.
68
68
           Returns (trimmed_string, count_of_trimmed_bytes).
69
69
        '''
70
 
        tokill = ivle.util.incomplete_utf8_sequence(stuff)
 
70
        tokill = common.util.incomplete_utf8_sequence(stuff)
71
71
        if tokill == 0:
72
72
            return (stuff, tokill)
73
73
        else:
208
208
 
209
209
        # Try to execute the buffer
210
210
        try:
211
 
            # A single trailing newline simply indicates that the line is
212
 
            # finished. Two trailing newlines indicate the end of a block.
213
 
            # Unfortunately, codeop.CommandCompiler causes even one to
214
 
            # terminate a block.
215
 
            # Thus we need to remove a trailing newline from the command,
216
 
            # unless there are *two* trailing newlines, or multi-line indented
217
 
            # blocks are impossible. See Google Code issue 105.
218
 
            cmd_text = self.curr_cmd
219
 
            if cmd_text.endswith('\n') and not cmd_text.endswith('\n\n'):
220
 
                cmd_text = cmd_text[:-1]
221
 
            cmd = self.cc(cmd_text, '<web session>')
 
211
            cmd = self.cc(self.curr_cmd, '<web session>')
222
212
            if cmd is None:
223
213
                # The command was incomplete, so send back a None, so the              
224
214
                # client can print a '...'
376
366
    if msg['cmd'] == 'terminate':
377
367
        terminate = "User requested console be terminated"
378
368
    if terminate:
379
 
        raise ivle.chat.Terminate({"terminate":terminate})
 
369
        raise common.chat.Terminate({"terminate":terminate})
380
370
    expiry.ping()
381
371
    lineQ.put((msg['cmd'],msg['text']))
382
372
    response = cmdQ.get()
383
373
    if terminate:
384
 
        raise ivle.chat.Terminate({"terminate":terminate})
 
374
        raise common.chat.Terminate({"terminate":terminate})
385
375
    return response
386
376
 
387
377
def format_exc_start(start=0):
403
393
            try:
404
394
                o_type = type(object[o]).__name__
405
395
                o_name = object[o].__name__
406
 
                fake_o = ivle.util.FakeObject(o_type, o_name)
 
396
                fake_o = common.util.FakeObject(o_type, o_name)
407
397
                flat[o] = cPickle.dumps(fake_o, PICKLEVERSION)
408
398
            except AttributeError:
409
399
                pass
425
415
    # Make python's search path follow the cwd
426
416
    sys.path[0] = ''
427
417
 
428
 
    ivle.chat.start_server(port, magic, True, dispatch_msg, initializer)
 
418
    common.chat.start_server(port, magic, True, dispatch_msg, initializer)