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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-01-22 05:46:42 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:265
apps: "serve" app now requires authentication like all other apps.
    (Because the "public viewing" functionality has been moved into the other
    subdomain).
consoleservice: Now demands a path: either "start" or "chat" (can't be
    nothing). "chat" functionality TBI.
console: Passes "start" as a path to consoleservice (or it would no longer
    work).

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
def handle(req):
36
36
    """Handler for the Console Service AJAX backend application."""
 
37
    if len(req.path) > 0 and req.path[-1] == os.sep:
 
38
        path = req.path[:-1]
 
39
    else:
 
40
        path = req.path
 
41
    # The path determines which "command" we are receiving
 
42
    if req.path == "start":
 
43
        handle_start(req)
 
44
    elif req.path == "chat":
 
45
        handle_chat(req)
 
46
    else:
 
47
        req.throw_error(req.HTTP_BAD_REQUEST)
 
48
 
 
49
def handle_start(req):
37
50
    jail_path = os.path.join(conf.jail_base, req.username)
38
51
    working_dir = os.path.join("/home", req.username)   # Within jail
39
52
 
73
86
 
74
87
    # Return port, magic
75
88
    req.write(cjson.encode({"host": host, "port": port, "magic": magic}))
 
89
 
 
90
def handle_chat(req):
 
91
    req.throw_error(req.HTTP_NOT_IMPLEMENTED)