Fix starting deluge-web when using osx/windows since the options are presented, the later conditionals fail since the options object does not have those attributes

This commit is contained in:
Andrew Resch 2011-06-06 14:57:50 -07:00
parent dfa8834db8
commit 5112ed48d1

View File

@ -100,7 +100,7 @@ class Web(_UI):
# Steps taken from http://www.faqs.org/faqs/unix-faq/programmer/faq/ # Steps taken from http://www.faqs.org/faqs/unix-faq/programmer/faq/
# Section 1.7 # Section 1.7
if self.options.fork: if self.options.ensure_value("fork", None):
# fork() so the parent can exit, returns control to the command line # fork() so the parent can exit, returns control to the command line
# or shell invoking the program. # or shell invoking the program.
if os.fork(): if os.fork():
@ -121,12 +121,12 @@ class Web(_UI):
if self.options.pidfile: if self.options.pidfile:
open(self.options.pidfile, "wb").write("%d\n" % os.getpid()) open(self.options.pidfile, "wb").write("%d\n" % os.getpid())
if self.options.group: if self.options.ensure_value("group", None):
if not self.options.group.isdigit(): if not self.options.group.isdigit():
import grp import grp
self.options.group = grp.getgrnam(self.options.group)[2] self.options.group = grp.getgrnam(self.options.group)[2]
os.setuid(self.options.group) os.setuid(self.options.group)
if self.options.user: if self.options.ensure_value("user", None):
if not self.options.user.isdigit(): if not self.options.user.isdigit():
import pwd import pwd
self.options.user = pwd.getpwnam(self.options.user)[2] self.options.user = pwd.getpwnam(self.options.user)[2]
@ -141,7 +141,7 @@ class Web(_UI):
if self.options.port: if self.options.port:
self.server.port = self.options.port self.server.port = self.options.port
if self.options.ssl: if self.options.ensure_value("ssl", None):
self.server.https = self.options.ssl self.server.https = self.options.ssl
if self.options.profile: if self.options.profile: