Giter Site home page Giter Site logo

django-basic-authentication-decorator's People

Contributors

jwodder avatar michd89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-basic-authentication-decorator's Issues

Missing author data in package

The package currently omits the author field and thus does not allow to display the correct author when further using it without additional work.

TypeError: 'bool' object is not callable with Django 2.0.2 and Python 3.6

Using Django 2.0.2 and Python3.6.4 the following error occurs when a request with the decorator is called.

Traceback (most recent call last):
File "/opt/exaboard/eXaboard/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/opt/exaboard/eXaboard/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/exaboard/eXaboard/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/exaboard/eXaboard/lib/python3.6/site-packages/django_basic_auth.py", line 81, in wrapper
realm, *args, **kwargs)
File "/opt/exaboard/eXaboard/lib/python3.6/site-packages/django_basic_auth.py", line 15, in view_or_basicauth
if test_func(request.user):
File "/opt/exaboard/eXaboard/lib/python3.6/site-packages/django_basic_auth.py", line 80, in
lambda u: u.is_authenticated(),
TypeError: 'bool' object is not callable

TypeError when on a view with keyword arguments

On a URL with a placeholder, meaning its view gets keyword arguments named after the URL placeholders, such as

url(r'^admin/video/(?P<id>[0-9]+)/download$', admin.video_download, name='admin.video.download'),

I get

TypeError: view_decorator() got an unexpected keyword argument 'id'

Keyword argument before variable positional arguments list in the definition of view_or_basicauth function

The function view_or_basicauth() has a bug. realm cannot be declared as a keyword before the variable *args. I believe the simple solution is to drop the assignment, otherwise you need to re-write to two callers ie: logged_in_or_basicauth and has_perm_or_basicauth. Removing the assignment seems like a safe action as both of the callers provide a default value.

Suggested signature:

def view_or_basicauth(view, request, test_func, realm, *args, **kwargs):

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.