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

« back to all changes in this revision

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

  • Committer: wagrant
  • Date: 2008-08-01 06:44:32 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:969
server: Use the noop interpreter to mount the user's jail so that authorisation
        works in public mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
    filename: Filename in the local file system.
80
80
    download:  Should the file be viewed in browser or downloaded
81
81
    """
 
82
 
 
83
    # We need a no-op trampoline run to ensure that the jail is mounted.
 
84
    # Otherwise we won't be able to authorise for public mode!
 
85
    noop_object = interpret.interpreter_objects["noop"]
 
86
    user_jail_dir = os.path.join(conf.jail_base, owner)
 
87
    interpret.interpret_file(req, owner, user_jail_dir, '', noop_object)
 
88
 
82
89
    # Authorize access. If failure, this throws a HTTP_FORBIDDEN error.
83
90
    authorize(req)
84
91
    
85
92
    # Jump into the jail
86
93
    interp_object = interpret.interpreter_objects["cgi-python"]
87
 
    user_jail_dir = os.path.join(conf.jail_base, owner)
88
94
    if download:
89
95
        req.headers_out["Content-Disposition"] = "attachment"
90
96
        interpret.interpret_file(req, owner, user_jail_dir,