[Twisted-web] Re: [PATCH] nevow.static.File directory listing

Matt Goodall matt at pollenation.net
Sat Apr 3 02:54:19 MST 2004


On Sat, 2004-04-03 at 07:54, Christopher Armstrong wrote:
> Lee Harr wrote:
> >> I was getting an infinitely recursive redirect
> > 
> > 
> > Actually, this patch (to nevow.static.File) will also
> > take care of the redirect:
> > 
> > 
> > 
> > 274c274,281
> > <             return self.redirect(request)
> > ---
> > 
> >>             if not request.uri.endswith('/'):
> >>                 self.redirect(request)
> 
> You want to return the self.redirect(request). Otherwise the 
> DirectoryLister will still get rendered to the body of the HTTP result, 
> to no effect.

It should probably also reuse the directoryListing() method, making the
change:

         if self.fp.isdir():
-            return self.redirect(request)
+            if not request.uri.endswith('/'):
+                return self.redirect(request)
+            return self.directoryListing()


-- 
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net

Any views expressed are my own and do not necessarily reflect
the views of my employer.




More information about the Twisted-web mailing list