issue 3
(how to use permission_required() decorator?) commented on by mariocesar.c50
- maybe is to late, but your are right. If you don't read carefully the decorator code,
you cannot know how to use it.
To use it, change your code like this:
def getProdotti(self):
"""Prende tutti i prodotti dal database"""
prodotti = Prodotto.objects.all()
p = serializers.serialize("python", prodotti)
return p
...
Note the self variable on the parameters of the function
maybe is to late, but your are right. If you don't read carefully the decorator code,
you cannot know how to use it.
To use it, change your code like this:
def getProdotti(self):
"""Prende tutti i prodotti dal database"""
prodotti = Prodotto.objects.all()
p = serializers.serialize("python", prodotti)
return p
...
Note the self variable on the parameters of the function
Older
Aug 29, 2008
issue 4
(Default template rendered for GET requests doesn't inherit c...) commented on by dchandekstark
- This isn't an issue if you use the most recent version of the source in which that
code has been deprecated.
This isn't an issue if you use the most recent version of the source in which that
code has been deprecated.
Aug 03, 2008
issue 4
(Default template rendered for GET requests doesn't inherit c...) reported by cristian.romanescu
- Using Django current #7869, django_xmlrpc-0.1.tar.gz
I wanted to customize the error message page for GET requests, but didn't
have available the context parameters added by context processors.
From Django manual:
"If you’re using Django’s render_to_response() shortcut to populate a
template with the contents of a dictionary, your template will be passed a
Context instance by default (not a RequestContext). To use a RequestContext
in your template rendering, pass an optional third argument to
render_to_response(): a RequestContext instance..."
Cheers,
Cristian.
Diff is:
Patch
34a35
> from django.template import RequestContext
75c76
< return render_to_response(settings.XMLRPC_GET_TEMPLATE)
---
> return render_to_response(settings.XMLRPC_GET_TEMPLATE,
context_instance=RequestContext(request))
Using Django current #7869, django_xmlrpc-0.1.tar.gz
I wanted to customize the error message page for GET requests, but didn't
have available the context parameters added by context processors.
From Django manual:
"If you’re using Django’s render_to_response() shortcut to populate a
template with the contents of a dictionary, your template will be passed a
Context instance by default (not a RequestContext). To use a RequestContext
in your template rendering, pass an optional third argument to
render_to_response(): a RequestContext instance..."
Cheers,
Cristian.
Diff is:
Patch
34a35
> from django.template import RequestContext
75c76
< return render_to_response(settings.XMLRPC_GET_TEMPLATE)
---
> return render_to_response(settings.XMLRPC_GET_TEMPLATE,
context_instance=RequestContext(request))
Jul 26, 2008
issue 3
(how to use permission_required() decorator?) reported by patrick.arminio
- Hi, I need to get private some xmlrpc methods but I don't know how to use
the permession_required decorator, with this code:
@xmlrpc_func(returns='array')
@permission_required()
def getProdotti():
"""Prende tutti i prodotti dal database"""
prodotti = Prodotto.objects.all()
p = serializers.serialize("python", prodotti)
return p
I get this error:
Traceback (most recent call last):
File "gestionale.py", line 5, in <module>
prodotti = s.getProdotti()
File "/usr/lib/python2.5/xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.5/xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "/usr/lib/python2.5/xmlrpclib.py", line 1201, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.5/xmlrpclib.py", line 1340, in _parse_response
return u.close()
File "/usr/lib/python2.5/xmlrpclib.py", line 787, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<type
'exceptions.TypeError'>:__authenticated_call() takes at least 2 arguments
(0 given)">
Hi, I need to get private some xmlrpc methods but I don't know how to use
the permession_required decorator, with this code:
@xmlrpc_func(returns='array')
@permission_required()
def getProdotti():
"""Prende tutti i prodotti dal database"""
prodotti = Prodotto.objects.all()
p = serializers.serialize("python", prodotti)
return p
I get this error:
Traceback (most recent call last):
File "gestionale.py", line 5, in <module>
prodotti = s.getProdotti()
File "/usr/lib/python2.5/xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.5/xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "/usr/lib/python2.5/xmlrpclib.py", line 1201, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.5/xmlrpclib.py", line 1340, in _parse_response
return u.close()
File "/usr/lib/python2.5/xmlrpclib.py", line 787, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<type
'exceptions.TypeError'>:__authenticated_call() takes at least 2 arguments
(0 given)">