Well, I have middleware class which is required to determine content-type 
of rendered page and if it is 'txt/html', then do some action. I've started 
just from seeing what content-types do I have on page and here is first 
problem I faced:

class StatsMiddleware(object): 
   def process_view(self, request, view_func, view_args, view_kwargs): 
      response = view_func(request, *view_args, **view_kwargs) 
      print response['Content-Type']

Executing this, I get few messages about content-types of page elements, 
like text/html, application/javascript and also tons of errors like key 
error: content-type and after that - broken pipe

So I assume that not all elements of page have such header Content-Type and 
my question is following:

Is there some general Content-Type that says 'That page is text/html' or 
there are a lot of content-types on page ?

And also if this is a proper way to deterimne content-type of page like 
this:

if response['Content-Type'] == 'text/html':
     pass

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5556d26e-1c9a-4a33-83fd-4cac589d87b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to