galaxy.web.framework package
Galaxy web application framework
- galaxy.web.framework.handle_url_for(*args, **kwargs) str [source]
Tries to resolve the URL using the routes module.
This only works in a WSGI app so a deprecation message is returned when running an ASGI app.
- galaxy.web.framework.url_for(*args, **kwargs) str
Tries to resolve the URL using the routes module.
This only works in a WSGI app so a deprecation message is returned when running an ASGI app.
Subpackages
- galaxy.web.framework.helpers package
- galaxy.web.framework.middleware package
- Submodules
- galaxy.web.framework.middleware.error module
- galaxy.web.framework.middleware.profile module
- galaxy.web.framework.middleware.remoteuser module
- galaxy.web.framework.middleware.request_id module
- galaxy.web.framework.middleware.sqldebug module
- galaxy.web.framework.middleware.static module
- galaxy.web.framework.middleware.statsd module
- galaxy.web.framework.middleware.translogger module
- galaxy.web.framework.middleware.xforwardedhost module
Submodules
galaxy.web.framework.base module
A simple WSGI application/framework.
- class galaxy.web.framework.base.DefaultWebTransaction(environ)[source]
Bases:
object
Wraps the state of a single web transaction (request/response cycle).
- TODO: Provide hooks to allow application specific state to be included
in here.
- galaxy.web.framework.base.lazy_property
alias of
LazyProperty
- galaxy.web.framework.base.server_starttime = 1718903010
time of the most recent server startup
- class galaxy.web.framework.base.WebApplication[source]
Bases:
object
A simple web application which maps requests to objects using routes, and to methods on those objects in the CherryPy style. Thus simple argument mapping in the CherryPy style occurs automatically, but more complicated encoding of arguments in the PATH_INFO can be performed with routes.
- __init__()[source]
Create a new web application object. To actually connect some controllers use add_controller and add_route. Call finalize_config when all controllers and routes have been added and __call__ to handle a request (WSGI style).
- add_ui_controller(controller_name, controller)[source]
Add a controller class to this application. A controller class has methods which handle web requests. To connect a URL to a controller’s method use add_route.
- add_route(route, **kwargs)[source]
Add a route to match a URL with a method. Accepts all keyword arguments of routes.Mapper.connect. Every route should result in at least a controller value which corresponds to one of the objects added with add_controller. It optionally may yield an action argument which will be used to locate the method to call on the controller. Additional arguments will be passed to the method as keyword args.
- set_transaction_factory(transaction_factory)[source]
Use the callable transaction_factory to create the transaction which will be passed to requests.
galaxy.web.framework.decorators module
- galaxy.web.framework.decorators.expose(func)[source]
Decorator: mark a function as ‘exposed’ and thus web accessible
- galaxy.web.framework.decorators.json(func, pretty=False)[source]
Format the response as JSON and set the response content type to JSON_CONTENT_TYPE.
- galaxy.web.framework.decorators.require_login(verb='perform this action', use_panels=False)[source]
- galaxy.web.framework.decorators.do_not_cache(func)[source]
Sets cache-prevention headers for the request.
- galaxy.web.framework.decorators.legacy_expose_api(func, to_json=True, user_required=True)[source]
Expose this function via the API.
- galaxy.web.framework.decorators.legacy_expose_api_raw(func)[source]
Expose this function via the API but don’t dump the results to JSON.
- galaxy.web.framework.decorators.legacy_expose_api_raw_anonymous(func)[source]
Expose this function via the API but don’t dump the results to JSON.
- galaxy.web.framework.decorators.legacy_expose_api_anonymous(func, to_json=True)[source]
Expose this function via the API but don’t require a set user.
- galaxy.web.framework.decorators.expose_api(func, to_json=True, user_required=True, user_or_session_required=True, handle_jsonp=True)[source]
Expose this function via the API.
- galaxy.web.framework.decorators.format_return_as_json(rval, jsonp_callback=None, pretty=False)[source]
Formats a return value as JSON or JSONP if jsonp_callback is present.
Use pretty=True to return pretty printed json.
- galaxy.web.framework.decorators.validation_error_to_message_exception(e: ValidationError | RequestValidationError) MessageException [source]
- galaxy.web.framework.decorators.expose_api_anonymous(func, to_json=True)[source]
Expose this function via the API but don’t require a set user.