wangwenchao / django-rest-interface

Automatically exported from code.google.com/p/django-rest-interface
0 stars 0 forks source link

Missing import in resource.py #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A missing import for gettext in resouce.py results in an exception when
using authentication to control access to an resource and the access are
denied.

Patch attached.

Original issue reported on code.google.com by sem...@gmail.com on 3 Aug 2008 at 7:34

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for the report.

What type of authentication were you using?

Original comment by alaasal...@gmail.com on 4 Aug 2008 at 7:16

GoogleCodeExporter commented 9 years ago
HttpBasicAuthentication

The following should reproduce the error

def api_authentication(username, password):
    return False

class ApiResource(Resource):
    def __init__(self, *args, **kwargs):
        Resource.__init__(self, *args, **kwargs)

        self.authentication = HttpBasicAuthentication(authfunc=api_authentication)

    def read(self, request, barcode, *args, **kwargs):
        #...
        pass

Original comment by sem...@gmail.com on 4 Aug 2008 at 8:47

GoogleCodeExporter commented 9 years ago
I have same bug on using HttpBasigAuthentication.

But I think, that using ugettext instead of gettext as in attached patch would 
be 
better opinion.

Original comment by playpaus...@gmail.com on 8 Oct 2008 at 10:49

GoogleCodeExporter commented 9 years ago
Applied semadk's patch modified according to Malcom's advice. Thanks.

Original comment by alaasal...@gmail.com on 11 Jan 2009 at 8:00