I'm trying to take a link as an argument, open it, read it's content
and then display the first 50 characters from it.
First of all, I've tried to put the code in the views.py, but I didn't
make it. Now I made a middleware component with this code:

import urllib2
from django.shortcuts import render_to_response

TEST_URL = 'http://127.0.0.1:8000/openurl/'

class Char50(object):
        def process_view(self, request, view_func, view_args, view_kwargs):
                query = request.POST.get('q', '')
                c = urllib2.urlopen(TEST_URL)
                contents = c.read( )
                conturl = contents[0:50]
                return render_to_response("test.html", { "query": query, 
"results":
conturl })

but the page seems to load forever and I'm stuck! I've read the
chapters from the djangobook, searched on the Internet, but I still
haven't found a solution.

Please help me!
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to