Skip to content

Commit bf0def9

Browse files
committed
add: wrapper which allows defining base layout
1 parent c2ec251 commit bf0def9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

basxbread/utils/urls.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def aslayout(view):
7878

7979
@wraps(view)
8080
def wrapper(request, *args, **kwargs):
81-
from .. import layout, menu # needs to be imported here to avoid cyclic imports
81+
from .. import layout, menu
8282

8383
response = view(request, *args, **kwargs)
8484
if isinstance(response, hg.BaseElement):
@@ -99,6 +99,14 @@ def wrapper(request, *args, **kwargs):
9999
return wrapper
100100

101101

102+
def aslayout_with(baselayout):
103+
def decorator(view):
104+
view.baselayout = baselayout
105+
return aslayout(view)
106+
107+
return decorator
108+
109+
102110
def autopath(*args, **kwargs):
103111
"""This function can be used to automatically generate a URL for a view.
104112
In many situations for internal database applications we are not too conserned

0 commit comments

Comments
 (0)