Coder Social home page Coder Social logo

Comments (7)

joernhees avatar joernhees commented on August 28, 2024

is this really business specific as mentioned in #245? redirects for permissions... maybe, but having world readable but not writable pages seems like a pretty standard thing to me

from gae-init.

bangive avatar bangive commented on August 28, 2024

i like it too

from gae-init.

nazroll avatar nazroll commented on August 28, 2024

+1

i don't think the use case would be business specific. rewriting the decorators to support args can help us build a more specific use case endpoints.

from gae-init.

jaxon avatar jaxon commented on August 28, 2024

+1

from gae-init.

joenorton avatar joenorton commented on August 28, 2024

What's an example of an argument you'd want to pass in? I want to better understand this.

You do know you can utilize variables in your route's inside the decorator, as-is, right? And that won't do the trick?

Here's an example decorator - where I am pulling the 'account_id' from the route and using it in the decorator:

def account_required(f):
    def account_decorator(f):
        decorator_order_guard(f, 'auth.account_required')

    @functools.wraps(f)
    def decorated_function(*args, **kws):
        account_id = kws['account_id']
        if current_user_account() == account_id:
            return f(*args, **kws)
        return flask.redirect(flask.url_for('account_list'))
    return decorated_function

from gae-init.

topless avatar topless commented on August 28, 2024

Just to add my 3.14 cents here, although kind of late, but just in case anyone stumbles on it. I am using mr. norton's approach looking in the request like

if 'my_variable' in kws: do_stuff()

For handling logic I would suggest to use the API section where you can actually decorate the methods you desire. Use control/ only for server side rendering.

from gae-init.

lipis avatar lipis commented on August 28, 2024

I'll pass on this one.. Also @topless idea could work :)

from gae-init.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.