diff --git a/attract/routes.py b/attract/routes.py index 689102d..58c43f6 100644 --- a/attract/routes.py +++ b/attract/routes.py @@ -72,7 +72,8 @@ def error_project_not_setup_for_attract(): return render_template('attract/errors/project_not_setup.html') -def attract_project_view(extra_project_projections=None, extension_props=False): +def attract_project_view(extra_project_projections: dict=None, extension_props=False, *, + full_project=False): """Decorator, replaces the first parameter project_url with the actual project. Assumes the first parameter to the decorated function is 'project_url'. It then @@ -84,10 +85,9 @@ def attract_project_view(extra_project_projections=None, extension_props=False): :param extra_project_projections: extra projections to use on top of the ones already used by this decorator. - :type extra_project_projections: dict :param extension_props: whether extension properties should be included. Includes them in the projections, and verifies that they are there. - :type extension_props: bool + :param full_project: skip projections altogether, fetching the whole project. """ from . import EXTENSION_NAME @@ -119,9 +119,10 @@ def attract_project_view(extra_project_projections=None, extension_props=False): api = pillar_api() + projection_param = None if full_project else {'projection': projections} project = pillarsdk.Project.find_by_url( project_url, - {'projection': projections}, + projection_param, api=api) is_attract = current_attract.is_attract_project(project, @@ -190,7 +191,7 @@ def project_settings(project: pillarsdk.Project, **template_args: dict): @blueprint.route('///set-task-types', methods=['POST']) -@attract_project_view(extension_props=True) +@attract_project_view(extension_props=True, full_project=True) def save_task_types(project, attract_props, node_type_name: str): from . import EXTENSION_NAME from . import setup