diff --git a/servefile b/servefile index 8050408..10dac92 100755 --- a/servefile +++ b/servefile @@ -301,6 +301,7 @@ class DirListingHandler(FileBaseHandler): self.getFileOrDirectory(head=False) def getFileOrDirectory(self, head=False): + """ Send file or directory index, depending on requested path """ path = self.getCleanPath() if os.path.isdir(path): @@ -327,20 +328,36 @@ class DirListingHandler(FileBaseHandler): self.end_headers() def sendDirectoryListing(self, path, head): - print "sending directory listing" - + """ Generate a directorylisting for path and send it """ header = """ Index of %(path)s + -

Index of %(path)s

+

Index of %(path)s

+
""" % {'path': posixpath.normpath(urllib.unquote(self.path))} - footer = """
NameLast ModifiedSizeType
-
servefile %(version)s
+ footer = """
+
servefile %(version)s
""" % {'version': __version__} content = [] @@ -368,10 +385,10 @@ class DirListingHandler(FileBaseHandler): fileType = "Directory" content.append(""" - %s - %s - %s - %s + %s + %s + %s + %s """ % (urllib.quote(item), item, lastModified, fileSize, fileType))