Use more Pythonic style in gunicorn/.

This commit is contained in:
Berker Peksag 2014-11-24 18:43:21 +02:00
parent 783984cabd
commit 56e7d15fb8
4 changed files with 3 additions and 4 deletions

View File

@ -314,7 +314,7 @@ class Logger(object):
def _get_gunicorn_handler(self, log): def _get_gunicorn_handler(self, log):
for h in log.handlers: for h in log.handlers:
if getattr(h, "_gunicorn", False) == True: if getattr(h, "_gunicorn", False):
return h return h
def _set_handler(self, log, output, fmt): def _set_handler(self, log, output, fmt):

View File

@ -406,7 +406,7 @@ def daemonize(enable_stdio_inheritance=False):
Standard daemonization of a process. Standard daemonization of a process.
http://www.svbug.com/documentation/comp.unix.programmer-FAQ/faq_2.html#SEC16 http://www.svbug.com/documentation/comp.unix.programmer-FAQ/faq_2.html#SEC16
""" """
if not 'GUNICORN_FD' in os.environ: if 'GUNICORN_FD' not in os.environ:
if os.fork(): if os.fork():
os._exit(0) os._exit(0)
os.setsid() os.setsid()

View File

@ -7,7 +7,7 @@ import sys
if sys.version_info >= (3, 3): if sys.version_info >= (3, 3):
try: try:
import aiohttp import aiohttp # NOQA
except ImportError: except ImportError:
raise RuntimeError("You need aiohttp installed to use this worker.") raise RuntimeError("You need aiohttp installed to use this worker.")
else: else:

View File

@ -15,7 +15,6 @@ from datetime import datetime
import errno import errno
from functools import partial from functools import partial
import os import os
import operator
import socket import socket
import ssl import ssl
import sys import sys