pyflakes pass.

This commit is contained in:
benoitc 2012-02-21 14:53:17 +01:00
parent 52a9e2e9a2
commit fa341c6531
8 changed files with 12 additions and 21 deletions

View File

@ -5,7 +5,6 @@
""" module used to build the django wsgi application """ """ module used to build the django wsgi application """
import logging
import os import os
import re import re
import sys import sys
@ -16,10 +15,9 @@ except ImportError:
from StringIO import StringIO from StringIO import StringIO
from django.conf import settings from django.conf import settings
from django.core.management.base import CommandError
from django.core.management.validation import get_validation_errors from django.core.management.validation import get_validation_errors
from django.utils import translation from django.utils import translation
from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException from django.core.servers.basehttp import AdminMediaHandler
try: try:
from django.core.servers.basehttp import get_internal_wsgi_application from django.core.servers.basehttp import get_internal_wsgi_application
django14 = True django14 = True

View File

@ -3,11 +3,9 @@
# This file is part of gunicorn released under the MIT license. # This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information. # See the NOTICE for more information.
import imp
import os import os
import sys import sys
from gunicorn.config import Config
from gunicorn.app.base import Application from gunicorn.app.base import Application
from gunicorn import util from gunicorn import util
@ -27,8 +25,8 @@ def find_settings_module(path):
if lvl > 2: if lvl > 2:
break break
elif os.path.isfile(path): elif os.path.isfile(path):
project_path = os.path.dirname(settings_path) project_path = os.path.dirname(path)
settings_name, _ = os.path.splitext(os.path.basename(settings_path)) settings_name, _ = os.path.splitext(os.path.basename(path))
return project_path, settings_name return project_path, settings_name
@ -43,16 +41,17 @@ def make_default_env(cfg):
sys.path.insert(0, pythonpath) sys.path.insert(0, pythonpath)
try: try:
settings_modname = os.environ['DJANGO_SETTINGS_MODULE'] _ = os.environ['DJANGO_SETTINGS_MODULE']
except KeyError: except KeyError:
# not settings env set, try to build one. # not settings env set, try to build one.
project_path, settings_name = find_settings_module(os.getcwd()) project_path, settings_name = find_settings_module(os.getcwd())
if not project_path: if not project_path:
raise RunTimeError("django project not found") raise RuntimeError("django project not found")
pythonpath, project_name = os.path.split(project_path) pythonpath, project_name = os.path.split(project_path)
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % project_name os.environ['DJANGO_SETTINGS_MODULE'] = "%s.%s" % (project_name,
settings_name)
if pythonpath not in sys.path: if pythonpath not in sys.path:
sys.path.insert(0, pythonpath) sys.path.insert(0, pythonpath)
@ -72,7 +71,7 @@ class DjangoApplication(Application):
os.path.abspath(args[0])) os.path.abspath(args[0]))
if not project_path: if not project_path:
raise RunTimeError("django project not found") raise RuntimeError("django project not found")
pythonpath, project_name = os.path.split(project_path) pythonpath, project_name = os.path.split(project_path)
self.cfg.set("django_settings", "%s.%s" % (project_name, self.cfg.set("django_settings", "%s.%s" % (project_name,

View File

@ -103,7 +103,7 @@ class Logger(object):
if os.path.exists(cfg.logconfig): if os.path.exists(cfg.logconfig):
fileConfig(cfg.logconfig) fileConfig(cfg.logconfig)
else: else:
raise RuntimeError("Error: log config '%s' not found" % path) raise RuntimeError("Error: log config '%s' not found" % cfg.logconfig)
def critical(self, msg, *args, **kwargs): def critical(self, msg, *args, **kwargs):

View File

@ -4,7 +4,6 @@
# See the NOTICE for more information. # See the NOTICE for more information.
from optparse import make_option from optparse import make_option
import sys
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError

View File

@ -11,7 +11,6 @@ def patch_django():
""" """
try: try:
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import BaseDatabaseWrapper, DatabaseError from django.db.backends import BaseDatabaseWrapper, DatabaseError
if "validate_thread_sharing" in BaseDatabaseWrapper.__dict__: if "validate_thread_sharing" in BaseDatabaseWrapper.__dict__:
@ -36,6 +35,6 @@ def patch_django():
BaseDatabaseWrapper.__init__ = _init BaseDatabaseWrapper.__init__ = _init
BaseDatabaseWrapper.validate_thread_sharing = _validate_thread_sharing BaseDatabaseWrapper.validate_thread_sharing = _validate_thread_sharing
except ImportError, e: except ImportError:
pass pass

View File

@ -4,7 +4,6 @@
# See the NOTICE for more information. # See the NOTICE for more information.
import errno import errno
import logging
import os import os
import socket import socket
import sys import sys

View File

@ -3,8 +3,6 @@
# This file is part of gunicorn released under the MIT license. # This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information. # See the NOTICE for more information.
import logging
import os import os
import signal import signal
import sys import sys
@ -149,9 +147,9 @@ class Worker(object):
elif isinstance(exc, (InvalidHeaderName, InvalidHeader,)): elif isinstance(exc, (InvalidHeaderName, InvalidHeader,)):
mesg = "<p>Invalid Header '%s'</p>" % str(exc) mesg = "<p>Invalid Header '%s'</p>" % str(exc)
elif isinstance(exc, LimitRequestLine): elif isinstance(exc, LimitRequestLine):
msg = "<p>%s</p>" % str(exc) mesg = "<p>%s</p>" % str(exc)
elif isinstance(exc, LimitRequestHeaders): elif isinstance(exc, LimitRequestHeaders):
msg = "<p>Error parsing headers: '%s'</p>" % str(exc) mesg = "<p>Error parsing headers: '%s'</p>" % str(exc)
if self.debug: if self.debug:
tb = traceback.format_exc() tb = traceback.format_exc()

View File

@ -24,7 +24,6 @@ from gevent import pywsgi
import gunicorn import gunicorn
from gunicorn.monkey import patch_django from gunicorn.monkey import patch_django
from gunicorn.workers.async import AsyncWorker from gunicorn.workers.async import AsyncWorker
from gunicorn.workers.base import Worker
VERSION = "gevent/%s gunicorn/%s" % (gevent.__version__, gunicorn.__version__) VERSION = "gevent/%s gunicorn/%s" % (gevent.__version__, gunicorn.__version__)