Austin,

There's an excellent overview of the how's and why's of Middleware at
http://www.djangoproject.com/documentation/middleware/

Fundamentally, you're just specifying a class that you've implemented
somewhere. It can be in a folder or not - that's just matching
python's module structure to the class name that you import.

I'd suggest working with "print" statements in a dev server instance
to get the feel for what's flowing through a middleware class. It
taught me a lot when I was getting started.

On Sun, Feb 17, 2008 at 11:29 AM, Austin Govella
<[EMAIL PROTECTED]> wrote:
>
>  On Jan 22, 9:39 pm, Dan Conner <[EMAIL PROTECTED]> wrote:
>  > well, one way to do this is through a middleware class, like this:
>  > class SetEmptyPathInfo(object):
>  >     def process_request(self, request):
>  >         if not request.path:
>  >             request.META['PATH_INFO'] = '/'
>  >             request.path = '/'
>  >
>  > seems to be working for now.
>
>  I'm hitting a similar error where PATH_INFO is empty and I get a
>  TypeError:
>
>  Exception Type: TypeError
>  Exception Value: unpack non-sequence
>
>  I'm trying to add the middleware class mentioned above, but I'm not
>  sure where it goes.
>
>  I created a middleware folder in my project folder and saved the
>  middleware class as SetEmptyPathInfo.py but I keep getting the above
>  error with PATH_INFO set to " ".
>
>  Is that how you add middleware to an app (add a middleware folder to
>  your project)? Is there a middleware tutorial somewhere that explains
>  where you save custom middleware files?
>
>
>
>  --
>  Austin Govella
>
>
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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