Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tough control over what's being added #10

Open
Mogost opened this issue May 22, 2024 · 0 comments
Open

Tough control over what's being added #10

Mogost opened this issue May 22, 2024 · 0 comments

Comments

@Mogost
Copy link

Mogost commented May 22, 2024

The only one way to control on exposing URLs is JS_REVERSE_EXCLUDE_NAMESPACES.
It's not enough because if you want to add only one URL you should move it to separated namespace and this doesn't looks right. Also when you want share namespace but hide URL.

I think we could try to do more fine-tuned control with a decorator. It could be attached to CBV functions or classes. And on the basis of this additional information at the stage of collection separate the necessary and unnecessary.
Moreover, this style is declarative and makes the control more simple.

def js_reverse(target):
    if isinstance(target, type):
        target.js_reverse = True
        return target

    @wraps(target)
    def wrapper_view(*args, **kwargs):
        return target(*args, **kwargs)

    wrapper_view.js_reverse = True
    return wrapper_view


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant