url as argument in a view
Hi
I was looking to solve this 'newbie' problem but I am unable to find a
correct solution.
I am trying to pass a url as an argument. The url regex in the urls
file is ok, but when I try execute the program I get this error
message:
rescan() takes exactly 1 argument (3 given)
where:
in views.py
def rescan(request):
return render_to_response('index.html',
context_instance=RequestContext(request, {'url':
url}))
in urls.py
(r'^rescan/(\b(https?)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/
%=~_|]*)', 'rescan'),
I guess the problem is passing a url like: http://www.foo.com
The three arguments are: http: + // + foo.com
But I've tried escape the url with:
url = urllib.quote(url_fetched.url, safe='')
Which in the url bar works ok: http://django-server:8000/program/rescan/http%3A%2F%2Fwww.foo.com
But the program is failing again with:
TypeError at /showmalcode/rescan/http://www.foo.com
rescan() takes exactly 1 argument (3 given)
Request Method: GET
Request URL: http://django-server:8000/program/rescan/http://www.foo.com
Django Version: 1.3 beta 1
Exception Type: TypeError
Exception Value:
rescan() takes exactly 1 argument (3 given)
Any hint?
Thanks in advance
Emilio
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home