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

« back to all changes in this revision

Viewing changes to www/apps/consoleservice/__init__.py

  • Committer: drtomc
  • Date: 2008-02-01 03:02:14 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:365
Make the console accept blocks of code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        handle_start(req)
52
52
    elif req.path == "chat":
53
53
        handle_chat(req)
54
 
    #elif req.path == "block":
55
 
    #    handle_block(req)
 
54
    elif req.path == "block":
 
55
        handle_chat(req, kind="block")
56
56
    else:
57
57
        req.throw_error(req.HTTP_BAD_REQUEST)
58
58
 
115
115
    # Return port, magic
116
116
    req.write(cjson.encode({"host": host, "port": port, "magic": magic}))
117
117
 
118
 
def handle_chat(req):
 
118
def handle_chat(req, kind = "chat"):
119
119
    # The request *should* have the following four fields:
120
120
    # host, port: Host and port where the console server apparently lives
121
121
    # digest, text: Fields to pass along to the console server
136
136
    except AttributeError:
137
137
        text = ""
138
138
 
139
 
    msg = {'cmd':'chat', 'text':text, 'digest':digest}
 
139
    msg = {'cmd':kind, 'text':text, 'digest':digest}
140
140
 
141
141
    sok = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
142
142
    sok.connect((host, port))