SF.net SVN: tmda: [2068] trunk/tmda-cgi/Session.py

[email protected] Thu, 05 Oct 2006 08:06:59 -0700
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2068
          http://svn.sourceforge.net/tmda/?rev=2068&view=rev
Author:   lack
Date:     2006-10-05 08:06:56 -0700 (Thu, 05 Oct 2006)

Log Message:
-----------
Patch from David K. Thompson for more ignoring of .svn directories in theme
choosing.

Modified Paths:
--------------
    trunk/tmda-cgi/Session.py

Modified: trunk/tmda-cgi/Session.py
===================================================================
--- trunk/tmda-cgi/Session.py	2006-10-04 21:30:35 UTC (rev 2067)
+++ trunk/tmda-cgi/Session.py	2006-10-05 15:06:56 UTC (rev 2068)
@@ -231,6 +231,12 @@
     # Clean up
     self.CleanUp()
 
+  def mylistdir(self):
+    """A specialized version of os.listdir() that ignores files that
+    start with a leading period."""
+    filelist = os.listdir(self.ThemesDir)
+    return [x for x in filelist if not (x.startswith('.'))]
+ 
   def GetTheme(self):
     "Set up current theme."
 
@@ -239,7 +245,7 @@
     if not self.has_key(("General", "Theme")) or not os.access \
       (os.path.join(self.ThemesDir, self[("General", "Theme")]), os.R_OK):
       # Pick the first theme in the themes directory
-      Themes = os.listdir(self.ThemesDir)
+      Themes = self.mylistdir()
       Themes.sort()
       self[("General", "Theme")] = Themes[0]
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.