[CalendarServer-changes] [818] CalendarServer/trunk/twistedcaldav/extensions.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 12 16:23:20 PST 2006


Revision: 818
          http://trac.macosforge.org/projects/calendarserver/changeset/818
Author:   wsanchez at apple.com
Date:     2006-12-12 16:23:20 -0800 (Tue, 12 Dec 2006)

Log Message:
-----------
make style modular

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/extensions.py

Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py	2006-12-13 00:16:50 UTC (rev 817)
+++ CalendarServer/trunk/twistedcaldav/extensions.py	2006-12-13 00:23:20 UTC (rev 818)
@@ -84,7 +84,7 @@
                     # Render from the index file
                     return self.createSimilarFile(ifp.path).render(req)
 
-                return self.render_directory(req)
+                return self.renderDirectory(req)
 
         try:
             f = self.fp.open()
@@ -109,16 +109,8 @@
 
         return response
 
-    def render_directory(self, request):
-        """
-        Render a directory listing.
-        """
-        title = "Directory listing for %s" % urllib.unquote(request.path)
-    
-        output = ["""<html>
-<head>
-<title>%(title)s</title>
-<style>
+    def directoryStyleSheet(self):
+        return """
 th, .even td, .odd td { padding-right: 0.5em; font-family: monospace}
 .even-dir { background-color: #efe0ef }
 .even { background-color: #eee }
@@ -133,7 +125,19 @@
 }
 body { border: 0; padding: 0; margin: 0; background-color: #efefef;}
 h1 {padding: 0.1em; background-color: #777; color: white; border-bottom: thin white dashed;}
-</style>
+"""
+
+    def renderDirectory(self, request):
+        """
+        Render a directory listing.
+        """
+        title = "Directory listing for %s" % urllib.unquote(request.path)
+    
+        output = [
+"""<html>
+<head>
+<title>%(title)s</title>
+<style>%(style)s</style>
 </head>
 <body>
 <div class="directory-listing">
@@ -141,7 +145,10 @@
 <table>
 
 <tr><th>Filename</th> <th>Size</th> <th>Last Modified</th> <th>File Type</th></tr>
-""" % { "title": urllib.unquote(request.uri) }]
+""" % {
+        "title": urllib.unquote(request.uri),
+        "style": self.directoryStyleSheet(),
+}]
 
         even = False
         for name in sorted(self.listChildren()):

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061212/e8a5e00d/attachment.html


More information about the calendarserver-changes mailing list