Add support for specification of summary and footer.
Wed Aug 24 18:38:04 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Add support for specification of summary and footer.
This patch adds support to allow you to specify the summary shown in the repo
list, as well as changing the default footer; all optional.
This is based on the patches sent by Zachary P. Landau and Remko Troncon.
{
hunk ./config.py.sample 24
+ # the text to appear in the top of repo list; this is also optional,
+ # and html-formatted
+ #summary = "I love darcs!"
+
+ # in case you want to change the beautiful default, you can specify an
+ # alternative footer here; it's optional, of course
+ #footer = "I don't like shoes"
+
hunk ./config.py.sample 62
+
+ # as with the base configuration, the footer is also optional, and it
+ # affects only this repository; if you don't specify, the one
+ # specified in base is used (and if you don't specify one there
+ # either, a default one is used)
+ #footer = "I don't like being cold"
hunk ./darcsweb.cgi 233
-<div class="page_footer_text">Crece desde el pueblo el futuro /
- crece desde el pie</div>
- """
+<div class="page_footer_text">%s</div>
+ """ % config.footer
hunk ./darcsweb.cgi 1268
-This is the repository index for a darcsweb site.<br/>
-These are all the available repositories.<br/>
+%(summary)s
hunk ./darcsweb.cgi 1277
- 'myname': all_configs.base.myname,
- 'css': all_configs.base.cssfile,
- 'fav': all_configs.base.darcsfav,
- 'logo': all_configs.base.darcslogo
+ 'myname': config.myname,
+ 'css': config.cssfile,
+ 'fav': config.darcsfav,
+ 'logo': config.darcslogo,
+ 'summary': config.summary
hunk ./darcsweb.cgi 1316
-def fill_config(name):
+def fill_config(name = None):
hunk ./darcsweb.cgi 1318
- for conf in dir(all_configs):
- if conf.startswith('__'):
- continue
- c = all_configs.__getattribute__(conf)
- if 'reponame' not in dir(c):
- continue
- if c.reponame == name:
- break
- else:
- # not found
- raise "RepoNotFound", name
+
+ if name:
+ # we only care about setting some configurations if a repo was
+ # specified; otherwise we only set the common configuration
+ # directives
+ for conf in dir(all_configs):
+ if conf.startswith('__'):
+ continue
+ c = all_configs.__getattribute__(conf)
+ if 'reponame' not in dir(c):
+ continue
+ if c.reponame == name:
+ break
+ else:
+ # not found
+ raise "RepoNotFound", name
hunk ./darcsweb.cgi 1338
- config.myreponame = base.myname + '?r=' + urllib.quote(name)
hunk ./darcsweb.cgi 1342
- config.reponame = c.reponame
- config.repodesc = c.repodesc
- config.repodir = c.repodir
- config.repourl = c.repourl
- config.repoencoding = c.repoencoding
+ if name:
+ config.myreponame = base.myname + '?r=' + urllib.quote(name)
+ config.reponame = c.reponame
+ config.repodesc = c.repodesc
+ config.repodir = c.repodir
+ config.repourl = c.repourl
+ config.repoencoding = c.repoencoding
hunk ./darcsweb.cgi 1355
+
+ if "summary" in dir(base):
+ config.summary = base.summary
+ else:
+ config.summary = """
+This is the repository index for a darcsweb site.<br/>
+These are all the available repositories.<br/>
+ """
+
+ if name and "footer" in dir(c):
+ config.footer = c.footer
+ elif "footer" in dir(base):
+ config.footer = base.footer
+ else:
+ config.footer = "Crece desde el pueblo el futuro / " \
+ + "crece desde el pie"
hunk ./darcsweb.cgi 1381
+ fill_config()
}