[Sourcebo-commits] jlbec commits r83 - trunk
svn-commits@oss.oracle.com
svn-commits at oss.oracle.com
Wed Feb 22 15:15:43 CST 2006
Author: jlbec
Date: 2006-02-22 15:15:43 -0600 (Wed, 22 Feb 2006)
New Revision: 83
Modified:
trunk/sb_gen_index
Log:
o Modify sb_gen_index so that you can override the content area of
source.html with content/home/source.html
Modified: trunk/sb_gen_index
===================================================================
--- trunk/sb_gen_index 2005-11-17 16:38:57 UTC (rev 82)
+++ trunk/sb_gen_index 2006-02-22 21:15:43 UTC (rev 83)
@@ -640,7 +640,7 @@
def scan_lists():
- """Generate the source page"""
+ """Generate the list page"""
t = sourcebo.template.Template(os.path.join(conf['templatepath'],
"main.html"))
@@ -708,6 +708,7 @@
"main.html"))
+ size = 128 * 1024 # 128K
sourcetext = get_nav_bar()
htmlconf = conf['htmlconfig'].copy()
@@ -715,7 +716,28 @@
for i in ('project', 'webname'):
htmlconf[i] = conf[i]
- sourcetext += """
+ source = os.path.join(conf['homepath'], "source.html")
+
+ # Missing file provides default source.html (it's allowed)
+ if os.path.exists(source):
+ if not os.path.isfile(source):
+ log.err("Path %s is not a file" % source)
+ return 1
+ try:
+ fd = open(source)
+ sourcecontent = fd.read(size)
+ fd.close()
+ except (IOError, OSError), e:
+ log.err('Unable to read "%s": %s' % (source, e))
+ fd.close()
+ return 1
+
+ if len(sourcetext) >= size:
+ log.err("File %s is larger than maximum size %d" %
+ (source, size))
+ return 1
+ else:
+ sourcecontent += """
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="2" WIDTH="100%%"
STYLE="font-size:smaller;">
<TR>
@@ -846,6 +868,7 @@
</TABLE>
""" % htmlconf
+ sourcetext += sourcecontent
t.set("content", sourcetext)
t.set("title", "Project Source Control: %s" % conf['projecttitle'])
More information about the Sourcebo-commits
mailing list