Repository :
http://git.fedorahosted.org/cgit/
On branch : master
---------------------------------------------------------------
commit 3e6922eee801331260c66fe7f7cf2ceadcecff26
Author: Matt Domsch <matt(a)domsch.com>
Date: Thu Dec 12 07:05:28 2013 -0600
generate-publiclist and lib: use project_template()
we need the project_template() work to run when generating the static publiclist
pages.
---------------------------------------------------------------
server/generate-publiclist | 3 ++-
server/mirrormanager/lib.py | 12 ++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/server/generate-publiclist b/server/generate-publiclist
index 23c5a8c..a965c35 100755
--- a/server/generate-publiclist
+++ b/server/generate-publiclist
@@ -19,6 +19,7 @@ from turbogears.view import engines
from turbogears.database import PackageHub
sys.path.append("/usr/share/mirrormanager/server")
from mirrormanager.model import Product, publiclist_arches, publiclist_hosts
+from mirrormanager.lib import project_template
hub = __connection__ = None
logger = None
@@ -148,7 +149,7 @@ def generate_all():
email = config.get('mirrormanager.report_problems_to_email',
'webmaster')
utcnow = dt.datetime.utcnow()
projectname = config.get('mirrormanager.projectname','Fedora')
- template = engine.load_template('mirrormanager.templates.publiclist')
+ template = engine.load_template(project_template('publiclist'))
generate_one_html(engine, template, pvaMatrix, projectname, products,
arches, email, utcnow)
for p in products:
diff --git a/server/mirrormanager/lib.py b/server/mirrormanager/lib.py
index 36ff56c..94c4099 100644
--- a/server/mirrormanager/lib.py
+++ b/server/mirrormanager/lib.py
@@ -108,11 +108,15 @@ def run_rsync(rsyncpath, extra_rsync_args=None):
tmpfile.seek(0)
return (result, tmpfile)
+
+def project_template(formname):
+ project = config.get("mirrormanager.project_template", "fedora")
+ template = "mirrormanager.templates.%s.%s" % (project, formname)
+ return template
+
def project_dict(formname, template_engine="kid", **kw):
d = dict()
- project = config.get("mirrormanager.project_template", "fedora")
- template = "%s:mirrormanager.templates.%s.%s" % (template_engine,
- project, formname)
- d['tg_template'] = template
+ template = project_template(formname, template_engine)
+ d['tg_template'] = "%s:%s" % (template_engine, template)
d.update(**kw)
return d