def get_app(self, app=None): """Obtain a new (decorated) WSGI app to hook into the origin server.""" if app is None: app = cherrypy.tree if self.conquer: try: import wsgiconq except ImportError: warnings.warn( "Error importing wsgiconq. pyconquer will not run.") else: app = wsgiconq.WSGILogger(app, c_calls=True) if self.validate: try: from wsgiref import validate except ImportError: warnings.warn( "Error importing wsgiref. The validator will not run.") else: # wraps the app in the validator app = validate.validator(app) return app
def sync_apps(profile=False, validate=False, conquer=False): apps = [] for base, app in cherrypy.tree.apps.iteritems(): if base == "/": base = "" if profile: app = profiler.make_app(app, aggregate=False) if conquer: try: import wsgiconq except ImportError: warnings.warn( "Error importing wsgiconq. pyconquer will not run.") else: app = wsgiconq.WSGILogger(app) if validate: try: from wsgiref import validate except ImportError: warnings.warn( "Error importing wsgiref. The validator will not run.") else: app = validate.validator(app) apps.append((base, app)) apps.sort() apps.reverse() for s in cherrypy.server.httpservers: s.mount_points = apps
def sync_apps(profile=False, validate=False, conquer=False): app = cherrypy.tree if profile: app = profiler.make_app(app, aggregate=False) if conquer: try: import wsgiconq except ImportError: warnings.warn("Error importing wsgiconq. pyconquer will not run.") else: app = wsgiconq.WSGILogger(app) if validate: try: from wsgiref import validate except ImportError: warnings.warn( "Error importing wsgiref. The validator will not run.") else: app = validate.validator(app) h = cherrypy.server.httpserver if hasattr(h, 'wsgi_app'): # CherryPy's wsgiserver h.wsgi_app = app elif hasattr(h, 'fcgiserver'): # flup's WSGIServer h.fcgiserver.application = app elif hasattr(h, 'scgiserver'): # flup's WSGIServer h.scgiserver.application = app
def get_app(self): """Obtain a new (decorated) WSGI app to hook into the origin server.""" import cherrypy app = cherrypy.tree if self.profile: app = profiler.make_app(app, aggregate=False) if self.conquer: try: import wsgiconq except ImportError: warnings.warn("Error importing wsgiconq. pyconquer will not run.") else: app = wsgiconq.WSGILogger(app, c_calls=True) if self.validate: try: from wsgiref import validate except ImportError: warnings.warn("Error importing wsgiref. The validator will not run.") else: app = validate.validator(app) return app
def get_app(self, app=None): if app is None: app = cherrypy.tree if self.conquer: try: import wsgiconq except ImportError: warnings.warn( 'Error importing wsgiconq. pyconquer will not run.') else: app = wsgiconq.WSGILogger(app, c_calls=True) if self.validate: try: from wsgiref import validate except ImportError: warnings.warn( 'Error importing wsgiref. The validator will not run.') else: app = validate.validator(app) return app