From 87336be46b1c5ee65a249ddc2a1915e879357eed Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Tue, 16 Feb 2010 14:24:40 +0100 Subject: [PATCH] remove unused import/var and some fixes --- gunicorn/arbiter.py | 4 +--- gunicorn/config.py | 4 +--- gunicorn/main.py | 6 +----- gunicorn/worker.py | 2 +- tests/t.py | 2 +- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 3fb98de6..deff9010 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -7,12 +7,10 @@ from __future__ import with_statement import copy import errno -import fcntl import logging import os import select import signal -import socket import sys import tempfile import time @@ -59,7 +57,7 @@ class Arbiter(object): a = os.stat(os.environ('PWD')) b = os.stat(os.getcwd()) if a.ino == b.ino and a.dev == b.dev: - cwd = pwd + cwd = os.environ('PWD') else: cwd = os.getcwd() except: diff --git a/gunicorn/config.py b/gunicorn/config.py index ad6e398d..f5978e2a 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -117,6 +117,4 @@ class Config(object): def before_exec(self, *args): return self._hook("before_exec", *args) - - - \ No newline at end of file + \ No newline at end of file diff --git a/gunicorn/main.py b/gunicorn/main.py index 0b97c5ba..6ef890a0 100644 --- a/gunicorn/main.py +++ b/gunicorn/main.py @@ -10,7 +10,6 @@ import optparse as op import os import pwd import pkg_resources -import re import sys from gunicorn.arbiter import Arbiter @@ -168,7 +167,7 @@ def paste_server(app, global_conf=None, host="127.0.0.1", port=None, daemonize(umask) else: os.setpgrp() - set_owner_process(opts.user, opts.group) + set_owner_process(user, group) arbiter.run() def run(): @@ -225,9 +224,6 @@ def run_django(): def run_paster(): from paste.deploy import loadapp, loadwsgi - _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I) - - def get_app(parser, opts, args): if len(args) != 1: parser.error("No application name specified.") diff --git a/gunicorn/worker.py b/gunicorn/worker.py index 7d7f4e22..790261cc 100644 --- a/gunicorn/worker.py +++ b/gunicorn/worker.py @@ -158,7 +158,7 @@ class Worker(object): try: # Last ditch attempt to notify the client of an error. mesg = "HTTP/1.0 500 Internal Server Error\r\n\r\n" - write_nonblock(sock, mesg) + util.write_nonblock(client, mesg) except: pass finally: diff --git a/tests/t.py b/tests/t.py index d2269c70..55c28cb8 100644 --- a/tests/t.py +++ b/tests/t.py @@ -97,7 +97,7 @@ def hasnot(a, b): def raises(exctype, func, *args, **kwargs): try: func(*args, **kwargs) - except exctype, inst: + except exctype: pass else: func_name = getattr(func, "func_name", "")