CVS: tmda-cgi tmda-cgi.py,1.39,1.40

Jim Ramsay <[email protected]>
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda-cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv25539

Modified Files:
	tmda-cgi.py 
Log Message:
Allow the login screen, traceback, etc to have the theme listed in defaults.ini instead of being hardcoded to "Blue".

"Blue" is still used as an ultimate fallback in case defaults.ini cannot be found, parsed, etc.


Index: tmda-cgi.py
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/tmda-cgi.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- tmda-cgi.py	16 Nov 2003 17:35:53 -0000	1.39
+++ tmda-cgi.py	15 Dec 2003 16:12:32 -0000	1.40
@@ -42,13 +42,26 @@
 # Prepare the traceback in case of uncaught exception
 import os
 import sys
+import ConfigParser
 import MyCgiTb
 import Template
 MyCgiTb.ErrTemplate = "prog_err2.html"
-Template.Template.Dict["ThemeDir"] = "%s/themes/Blue" % \
-  os.environ["TMDA_CGI_DISP_DIR"]
-Template.Template.BaseDir = "%s/display/themes/Blue/template" % \
-  os.path.abspath(os.path.split(sys.argv[0])[0])
+
+# Setup the "default" theme so it is used for traceback.
+defaultTheme = "Blue"
+# If possible, get the theme from defaults.ini, else fallback to default
+# setting, above
+try:
+  localDefaults = ConfigParser.ConfigParser()
+  localDefFile = os.path.join( os.getcwd(), "defaults.ini" )
+  localDefaults.read(localDefFile)
+  defaultTheme = localDefaults.get("General", "Theme")
+except:
+  pass
+Template.Template.Dict["ThemeDir"] = "%s/themes/%s" % \
+  ( os.environ["TMDA_CGI_DISP_DIR"], defaultTheme )
+Template.Template.BaseDir = "%s/display/themes/%s/template" % \
+  ( os.path.abspath(os.path.split(sys.argv[0])[0]), defaultTheme )
 
 import cgi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.