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

« back to all changes in this revision

Viewing changes to ivle/interpret.py

  • Committer: William Grant
  • Date: 2010-02-25 03:18:21 UTC
  • Revision ID: grantw@unimelb.edu.au-20100225031821-mi9a2tm5679fht4d
Shuffle things around so that req.user and req.store only construct when actually retrieved, and ensure they're not retrieved for media files. Saves 50ms of DB connection time per request.

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
    fixup_environ(req, script_path)
140
140
 
141
141
    # usage: tramp uid jail_dir working_dir script_path
142
 
    pid = subprocess.Popen(
143
 
        [trampoline, str(uid), req.config['paths']['jails']['mounts'],
 
142
    cmd_line = [trampoline, str(uid), req.config['paths']['jails']['mounts'],
144
143
         req.config['paths']['jails']['src'],
145
144
         req.config['paths']['jails']['template'],
146
 
         jail_dir, working_dir, interpreter, script_path],
 
145
         jail_dir, working_dir, interpreter, script_path]
 
146
    # Popen doesn't like unicode strings. It hateses them.
 
147
    cmd_line = [(s.encode('utf-8') if isinstance(s, unicode) else s)
 
148
                for s in cmd_line]
 
149
    pid = subprocess.Popen(cmd_line,
147
150
        stdin=f, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
148
151
        cwd=tramp_dir)
149
152
 
432
435
    tramp_dir = os.path.split(tramp)[0]
433
436
 
434
437
    # Fire up trampoline. Vroom, vroom.
435
 
    proc = subprocess.Popen(
436
 
        [tramp, str(user.unixid), config['paths']['jails']['mounts'],
 
438
    cmd_line = [tramp, str(user.unixid), config['paths']['jails']['mounts'],
437
439
         config['paths']['jails']['src'],
438
440
         config['paths']['jails']['template'],
439
 
         jail_dir, working_dir, binary] + args,
 
441
         jail_dir, working_dir, binary] + args
 
442
    # Popen doesn't like unicode strings. It hateses them.
 
443
    cmd_line = [(s.encode('utf-8') if isinstance(s, unicode) else s)
 
444
                for s in cmd_line]
 
445
    proc = subprocess.Popen(cmd_line,
440
446
        stdin=subprocess.PIPE, stdout=subprocess.PIPE,
441
447
        stderr=subprocess.PIPE, cwd=tramp_dir, close_fds=True)
442
448