Allow calling a @attract_project_view()-decorated function efficiently.
@attract_project_view() now checks to see if you're passing an SDK resource as the first parameter. In that case it assumes you know what you're doing and simply passes all parameters as-is.
This commit is contained in:
@@ -60,6 +60,12 @@ def attract_project_view(extra_project_projections=None, extension_props=False):
|
|||||||
def decorator(wrapped):
|
def decorator(wrapped):
|
||||||
@functools.wraps(wrapped)
|
@functools.wraps(wrapped)
|
||||||
def wrapper(project_url, *args, **kwargs):
|
def wrapper(project_url, *args, **kwargs):
|
||||||
|
if isinstance(project_url, pillarsdk.Resource):
|
||||||
|
# This is already a resource, so this call probably is from one
|
||||||
|
# view to another. Assume the caller knows what he's doing and
|
||||||
|
# just pass everything along.
|
||||||
|
return wrapped(project_url, *args, **kwargs)
|
||||||
|
|
||||||
api = pillar_api()
|
api = pillar_api()
|
||||||
|
|
||||||
project = pillarsdk.Project.find_by_url(
|
project = pillarsdk.Project.find_by_url(
|
||||||
|
Reference in New Issue
Block a user