mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Require explicit tagging on views taking query parameters
Require each view to declare which query parameters it wants, and filter out any other parameters. We have very few views that actually take query parameters, and random additional query patterns will have no effect on the view. However, they will break frontend caching (in making them look like different pages). This will be extended into an implementation in the caching frontends as well, btu it's needed in the backend to ensure that local testing will have tbe same effect as the caches.
This commit is contained in:
@ -24,6 +24,17 @@ def cache(days=0, hours=0, minutes=0, seconds=0):
|
||||
return _cache
|
||||
|
||||
|
||||
def queryparams(*args):
|
||||
"""
|
||||
Allow specified query parameters when calling function.
|
||||
NOTE! Must be the "outermost" decorator!!!
|
||||
"""
|
||||
def _queryparams(fn):
|
||||
fn.queryparams = args
|
||||
return fn
|
||||
return _queryparams
|
||||
|
||||
|
||||
def allow_frames(fn):
|
||||
def _allow_frames(request, *_args, **_kwargs):
|
||||
resp = fn(request, *_args, **_kwargs)
|
||||
|
Reference in New Issue
Block a user