Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1642

Show
Ignore:
Timestamp:
03/19/07 02:24:19
Author:
fumanchu
Message:

Various restsrv fixes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/restsrv/__init__.py

    r1639 r1642  
    4545    from cherrypy.restsrv import win32 
    4646    engine = win32.Engine() 
     47    del win32 
    4748except ImportError: 
    4849    from cherrypy.restsrv import base 
    4950    engine = base.Engine() 
     51    del base 
  • trunk/cherrypy/restsrv/restctl

    r1639 r1642  
    22 
    33import getopt 
     4import os 
     5localDir = os.path.dirname(__file__) 
    46import signal 
    57import sys 
     
    2830    print """ 
    2931Usage: 
    30     webctl [options] command 
     32    restctl [options] command 
    3133     
    3234 
     
    6163 
    6264def spawn_child(opts): 
    63     args = [] 
    64     for k, v in opts: 
     65    restd_path = os.path.join(localDir, 'restd.py') 
     66    args = [sys.executable, restd_path] 
     67    for k, v in opts.iteritems(): 
    6568        if v: 
    6669            args.append('%s=%s' % (k, v)) 
     
    6871            args.append(k) 
    6972     
    70     pid = os.spawnpv(os.P_NOWAIT, 'restd', ' '.join(args)
     73    pid = os.spawnv(os.P_NOWAIT, sys.executable, args
    7174 
    7275 
     
    8588 
    8689if __name__ == '__main__': 
    87     try: 
    88         run() 
    89     except: 
    90         help() 
    91         sys.exit(2) 
     90    run() 
  • trunk/cherrypy/restsrv/restd.py

    r1639 r1642  
    4141 
    4242 
    43 def importer(name) 
     43def importer(name): 
    4444    # Wrap the given 'name' in a closure. 
    4545    def _import(): 
     
    5252    if '--project' in opts: 
    5353        # delay import until after daemonize has a chance to run 
    54         engine.subscribe('start', importer(opts['--project'])) 
     54        restsrv.engine.subscribe('start', importer(opts['--project'])) 
    5555     
    5656    if 'win' not in sys.platform: 
    57         engine.subscribe('start', restsrv.plugins.daemonize) 
     57        restsrv.engine.subscribe('start', restsrv.plugins.daemonize) 
    5858     
    59     engine.start() 
    60     engine.block() 
     59    restsrv.engine.start() 
     60    restsrv.engine.block() 
    6161 
    6262 
  • trunk/cherrypy/restsrv/win32.py

    r1639 r1642  
    11"""Windows service for restsrv. Requires pywin32.""" 
    22 
     3import thread 
     4import win32api 
     5import win32con 
     6import win32event 
     7import win32service 
    38import win32serviceutil 
    4 import win32service 
    5 import win32event 
    6 import win32con 
    7 import win32api 
    89 
    910from cherrypy.restsrv import base 
     
    2930        """Block forever (wait for stop(), KeyboardInterrupt or SystemExit).""" 
    3031        try: 
    31             win32event.WaitForSingleObject(self.stop_event, 
    32                                            win32event.INFINITE) 
     32            win32event.WaitForSingleObject(self.stop_event, win32event.INFINITE) 
    3333        except SystemExit: 
    3434            self.log('SystemExit raised: shutting down engine') 

Hosted by WebFaction

Log in as guest/cpguest to create tickets