summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Paul Glass <tempura@internode.on.net>2013-08-01 00:06:47 +1000
committerJulian Paul Glass <tempura@internode.on.net>2013-08-01 00:06:47 +1000
commit8fc233823ea121a13cfeb61efc371144bec96ba3 (patch)
treeafa3f20f156428e8253a47279813aa3d7eea7036
parent6012965b3441f93ee83408bb5cd0c21c091ca6db (diff)
downloadpyramid-8fc233823ea121a13cfeb61efc371144bec96ba3.tar.gz
pyramid-8fc233823ea121a13cfeb61efc371144bec96ba3.tar.bz2
pyramid-8fc233823ea121a13cfeb61efc371144bec96ba3.zip
Replaced references tow self.verbose with self.option.verbose
-rw-r--r--pyramid/scripts/pserve.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index 0feb9cd69..c012abb01 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -162,7 +162,6 @@ class PServeCommand(object):
def __init__(self, argv, quiet=False):
self.quiet = quiet
self.options, self.args = self.parser.parse_args(argv[1:])
- self.verbose = self.options.verbose
def out(self, msg): # pragma: no cover
if not self.quiet:
@@ -202,7 +201,7 @@ class PServeCommand(object):
if self.options.reload:
if os.environ.get(self._reloader_environ_key):
- if self.verbose > 1:
+ if self.options.verbose > 1:
self.out('Running reloading file monitor')
install_reloader(int(self.options.reload_interval), [app_spec])
# if self.requires_config_file:
@@ -276,7 +275,7 @@ class PServeCommand(object):
try:
self.daemonize()
except DaemonizeException as ex:
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out(str(ex))
return 2
@@ -308,7 +307,7 @@ class PServeCommand(object):
app = self.loadapp(app_spec, name=app_name, relative_to=base,
global_conf=vars)
- if self.verbose > 0:
+ if self.options.verbose > 0:
if hasattr(os, 'getpid'):
msg = 'Starting server in PID %i.' % os.getpid()
else:
@@ -319,7 +318,7 @@ class PServeCommand(object):
try:
server(app)
except (SystemExit, KeyboardInterrupt) as e:
- if self.verbose > 1:
+ if self.options.verbose > 1:
raise
if str(e):
msg = ' ' + str(e)
@@ -363,7 +362,7 @@ class PServeCommand(object):
"Daemon is already running (PID: %s from PID file %s)"
% (pid, self.options.pid_file))
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out('Entering daemon mode')
pid = os.fork()
if pid:
@@ -438,11 +437,11 @@ class PServeCommand(object):
def record_pid(self, pid_file):
pid = os.getpid()
- if self.verbose > 1:
+ if self.options.verbose > 1:
self.out('Writing PID %s to %s' % (pid, pid_file))
with open(pid_file, 'w') as f:
f.write(str(pid))
- atexit.register(self._remove_pid_file, pid, pid_file, self.verbose)
+ atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)
def stop_daemon(self): # pragma: no cover
pid_file = self.options.pid_file or 'pyramid.pid'
@@ -495,7 +494,7 @@ class PServeCommand(object):
self.restart_with_monitor(reloader=True)
def restart_with_monitor(self, reloader=False): # pragma: no cover
- if self.verbose > 0:
+ if self.options.verbose > 0:
if reloader:
self.out('Starting subprocess with file monitor')
else:
@@ -516,7 +515,7 @@ class PServeCommand(object):
proc = None
except KeyboardInterrupt:
self.out('^C caught in monitor process')
- if self.verbose > 1:
+ if self.options.verbose > 1:
raise
return 1
finally:
@@ -532,7 +531,7 @@ class PServeCommand(object):
# a monitor, any exit code will restart
if exit_code != 3:
return exit_code
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))
def change_user_group(self, user, group): # pragma: no cover
@@ -564,7 +563,7 @@ class PServeCommand(object):
if not gid:
gid = entry.pw_gid
uid = entry.pw_uid
- if self.verbose > 0:
+ if self.options.verbose > 0:
self.out('Changing user to %s:%s (%s:%s)' % (
user, group or '(unknown)', uid, gid))
if gid: