Code Monkey home page Code Monkey logo

Comments (8)

jettify avatar jettify commented on August 16, 2024

Completely agree with your points but I am afraid that decorator feature will be asked a lot of times, since this is how other frameworks doing permissions (both Django and flask advocate login_required decorator)

from aiohttp-security.

asvetlov avatar asvetlov commented on August 16, 2024

We can document the reason for decision

from aiohttp-security.

Maillol avatar Maillol commented on August 16, 2024

Ok I understand your position but if I want offer a more hight-level API, can I do it without have line to put a breakpoint ?
Perhaps a debug mode can be added, I saw that Python3.7 will add new built-in breakpoint() function (https://www.python.org/dev/peps/pep-0553/)

from aiohttp-security.

asvetlov avatar asvetlov commented on August 16, 2024

I'd like to have the issue implemented first, after that we can consider high-level API for class based views.
#148 is not necessary, not sure about #150

from aiohttp-security.

gyermolenko avatar gyermolenko commented on August 16, 2024

@asvetlov

Setting a breakpoint to decorator itself leads to debugging all handlers with decorator applied, not the specific one.

Here is one possible workaround

def login_required(f):
    if f.__name__ == 'handler2':
        import pdb; pdb.set_trace()

Alternatively IDEs like PyCharm have conditional breakpoints - in this case you don't need two lines above.

from aiohttp-security.

asvetlov avatar asvetlov commented on August 16, 2024

It requires changing or setting a breakpoint on the outer project, not user's application.

from aiohttp-security.

alk3mist avatar alk3mist commented on August 16, 2024

Isn't it better if the implementation of the check_permission remains for the user. In that case there is no need to remove decorator, just some func parameter in has_permission, which by default will be the current implementation of the permission checking. It will also allow to use more sofisticated permission checks, e.g. http://www.django-rest-framework.org/api-guide/permissions/#examples

from aiohttp-security.

asvetlov avatar asvetlov commented on August 16, 2024

Done by 0.3 release

from aiohttp-security.

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.