raising ConfigurationError is cleaner; remove some unused imports stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 12 Jan 2010 17:24:46 +0100
branchstable
changeset 4221 da84ca26896d
parent 4220 713434095f0d
child 4238 b8ea99f5e8ea
raising ConfigurationError is cleaner; remove some unused imports
etwist/server.py
--- a/etwist/server.py	Tue Jan 12 15:12:51 2010 +0100
+++ b/etwist/server.py	Tue Jan 12 17:24:46 2010 +0100
@@ -15,13 +15,12 @@
 from datetime import date, timedelta
 from urlparse import urlsplit, urlunsplit
 
-from twisted.application import strports
 from twisted.internet import reactor, task, threads
 from twisted.internet.defer import maybeDeferred
 from twisted.web2 import channel, http, server, iweb
 from twisted.web2 import static, resource, responsecode
 
-from cubicweb import ObjectNotFound, CW_EVENT_MANAGER
+from cubicweb import ConfigurationError, CW_EVENT_MANAGER
 from cubicweb.web import (AuthenticationError, NotFound, Redirect,
                           RemoteCallFailed, DirectResponse, StatusResponse,
                           ExplicitLogin)
@@ -296,7 +295,6 @@
             content = self.appli.need_login_content(req)
         return http.Response(code, req.headers_out, content)
 
-from twisted.python import failure
 from twisted.internet import defer
 from twisted.web2 import fileupload
 
@@ -388,8 +386,8 @@
     logger = getLogger('cubicweb.twisted')
     if not debug:
         if sys.platform == 'win32':
-            print "Under windows, you must use the service management commands (e.g : 'net start my_instance)'"
-            sys.exit(0)
+            raise ConfigurationError("Under windows, you must use the service management "
+                                     "commands (e.g : 'net start my_instance)'")
         print 'instance starting in the background'
         if daemonize():
             return # child process