Changeset 1219
- Timestamp:
- 08/05/06 18:05:52
- Files:
-
- trunk/cherrypy/__init__.py (modified) (1 diff)
- trunk/cherrypy/_cpserver.py (modified) (3 diffs)
- trunk/cherrypy/lib/covercp.py (modified) (1 diff)
- trunk/cherrypy/lib/profiler.py (modified) (1 diff)
- trunk/cherrypy/test/benchmark.py (modified) (1 diff)
- trunk/cherrypy/test/helper.py (modified) (2 diffs)
- trunk/cherrypy/test/test_session_concurrency.py (modified) (1 diff)
- trunk/cherrypy/test/test_states.py (modified) (4 diffs)
- trunk/cherrypy/test/test_states_demo.py (modified) (1 diff)
- trunk/cherrypy/tutorial/bonus-sqlobject.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut02_expose_methods.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut03_get_and_post.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut04_complex_site.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut05_derived_objects.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut06_default_method.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut07_sessions.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut08_generators_and_yield.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut09_files.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut10_http_errors.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/__init__.py
r1205 r1219 21 21 """Mount the given app, start the engine and builtin server, then block.""" 22 22 tree.mount(root, script_name, conf) 23 server. start()23 server.quickstart() 24 24 engine.start() 25 25 trunk/cherrypy/_cpserver.py
r1217 r1219 16 16 self.interrupt = None 17 17 18 def start(self, server=None): 19 """Main function. MUST be called from the main thread.""" 20 self.interrupt = None 18 def quickstart(self, server=None): 19 """Main function for quick starts. MUST be called from the main thread. 20 21 This function works like CherryPy 2's server.start(). It loads and 22 starts an httpserver based on the given server object, if any, and 23 config entries. 24 """ 21 25 httpserver, bind_addr = self.httpserver_from_config(server) 22 26 self.httpservers[httpserver] = bind_addr 23 self. _start_http(httpserver)27 self.start() 24 28 25 29 def httpserver_from_config(self, httpserver=None): … … 43 47 return httpserver, conf('server.socket_file') 44 48 45 def start _all(self):49 def start(self): 46 50 """Start all registered HTTP servers.""" 51 self.interrupt = None 47 52 for httpserver in self.httpservers: 48 53 self._start_http(httpserver) … … 121 126 """Restart the HTTP server.""" 122 127 self.stop() 123 self.interrupt = None 124 self.start_all() 128 self.start() 125 129 126 130 trunk/cherrypy/lib/covercp.py
r1135 r1219 350 350 351 351 import cherrypy 352 cherrypy.tree.mount(CoverStats())353 352 cherrypy.config.update({'server.socket_port': port, 354 353 'server.thread_pool': 10, 355 354 'environment': "production", 356 355 }) 357 cherrypy.server.start() 358 cherrypy.engine.start() 356 cherrypy.quickstart(CoverStats()) 359 357 360 358 if __name__ == "__main__": trunk/cherrypy/lib/profiler.py
r1194 r1219 171 171 def serve(path=None, port=8080): 172 172 import cherrypy 173 cherrypy.tree.mount(Profiler(path))174 173 cherrypy.config.update({'server.socket_port': int(port), 175 174 'server.thread_pool': 10, 176 175 'environment': "production", 177 176 }) 178 cherrypy.server.start() 179 cherrypy.engine.start() 177 cherrypy.quickstart(Profiler(path)) 180 178 181 179 trunk/cherrypy/test/benchmark.py
r1191 r1219 402 402 cherrypy.server.response_class = NullResponse 403 403 404 cherrypy.server. start()404 cherrypy.server.quickstart() 405 405 # This will block 406 406 cherrypy.engine.start_with_callback(run) trunk/cherrypy/test/helper.py
r1217 r1219 98 98 cherrypy.config.reset() 99 99 setConfig(conf) 100 cherrypy.server. start(server)100 cherrypy.server.quickstart(server) 101 101 cherrypy.engine.start_with_callback(_run_test_suite_thread, 102 102 args=(moduleNames, conf)) … … 148 148 setConfig(conf) 149 149 try: 150 cherrypy.server. start()150 cherrypy.server.quickstart() 151 151 cherrypy.engine.start_with_callback(_test_main_thread) 152 152 except KeyboardInterrupt: trunk/cherrypy/test/test_session_concurrency.py
r1096 r1219 80 80 81 81 # Start server 82 cherrypy.server. start()82 cherrypy.server.quickstart() 83 83 thread.start_new_thread(cherrypy.engine.start, ()) 84 84 trunk/cherrypy/test/test_states.py
r1217 r1219 68 68 69 69 # Test server start 70 cherrypy.server. start(self.server_class)70 cherrypy.server.quickstart(self.server_class) 71 71 cherrypy.engine.start(blocking=False) 72 72 self.assertEqual(cherrypy.engine.state, 1) … … 111 111 112 112 def test_1_Restart(self): 113 cherrypy.server.start( self.server_class)113 cherrypy.server.start() 114 114 cherrypy.engine.start(blocking=False) 115 115 … … 153 153 # We must start the server in this, the main thread 154 154 cherrypy.engine.start(blocking=False) 155 cherrypy.server.start( self.server_class)156 cherrypy.server.httpservers. values()[0].interrupt = KeyboardInterrupt155 cherrypy.server.start() 156 cherrypy.server.httpservers.keys()[0].interrupt = KeyboardInterrupt 157 157 while cherrypy.engine.state != 0: 158 158 time.sleep(0.1) … … 167 167 # thread will just die without writing a response. 168 168 cherrypy.engine.start(blocking=False) 169 cherrypy.server.start( self.server_class)169 cherrypy.server.start() 170 170 171 171 from httplib import BadStatusLine trunk/cherrypy/test/test_states_demo.py
r1206 r1219 28 28 }) 29 29 cherrypy.quickstart(Root()) 30 30 trunk/cherrypy/tutorial/bonus-sqlobject.py
r1096 r1219 166 166 print "If you're running this application for the first time, please go to http://localhost:8080/reset once in order to create the database!" 167 167 168 cherrypy.tree.mount(ContactManager()) 169 cherrypy.server.start() 170 cherrypy.engine.start() 168 cherrypy.quickstart(ContactManager()) trunk/cherrypy/tutorial/tut02_expose_methods.py
r1110 r1219 25 25 import os.path 26 26 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 27 cherrypy.server. start()27 cherrypy.server.quickstart() 28 28 cherrypy.engine.start() 29 29 trunk/cherrypy/tutorial/tut03_get_and_post.py
r1110 r1219 47 47 import os.path 48 48 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 49 cherrypy.server. start()49 cherrypy.server.quickstart() 50 50 cherrypy.engine.start() trunk/cherrypy/tutorial/tut04_complex_site.py
r1110 r1219 89 89 import os.path 90 90 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 91 cherrypy.server. start()91 cherrypy.server.quickstart() 92 92 cherrypy.engine.start() 93 93 trunk/cherrypy/tutorial/tut05_derived_objects.py
r1110 r1219 76 76 import os.path 77 77 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 78 cherrypy.server. start()78 cherrypy.server.quickstart() 79 79 cherrypy.engine.start() 80 80 trunk/cherrypy/tutorial/tut06_default_method.py
r1110 r1219 57 57 import os.path 58 58 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 59 cherrypy.server. start()59 cherrypy.server.quickstart() 60 60 cherrypy.engine.start() 61 61 trunk/cherrypy/tutorial/tut07_sessions.py
r1110 r1219 37 37 import os.path 38 38 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 39 cherrypy.server. start()39 cherrypy.server.quickstart() 40 40 cherrypy.engine.start() 41 41 trunk/cherrypy/tutorial/tut08_generators_and_yield.py
r1110 r1219 39 39 import os.path 40 40 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 41 cherrypy.server. start()41 cherrypy.server.quickstart() 42 42 cherrypy.engine.start() 43 43 trunk/cherrypy/tutorial/tut09_files.py
r1110 r1219 98 98 # Start the CherryPy server. 99 99 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 100 cherrypy.server. start()100 cherrypy.server.quickstart() 101 101 cherrypy.engine.start() trunk/cherrypy/tutorial/tut10_http_errors.py
r1096 r1219 75 75 # Start the CherryPy server. 76 76 cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 77 cherrypy.server. start()77 cherrypy.server.quickstart() 78 78 cherrypy.engine.start()

