Mercurial > treepkg
view contrib/sawmill/web/index.py @ 495:ca95be9d033a
add tests for determine debian upstream version
fix calling determine_upstream_version in determine_package_version
update authors
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Thu, 14 Oct 2010 07:49:50 +0000 |
parents | 28aa6ac933fb |
children |
line wrap: on
line source
# -*- coding: UTF-8 -*- # # Copyright (C) 2010 by Intevation GmbH # Authors: # Sascha L. Teichmann <sascha.teichmann@intevation.de> # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with the software for details. from mod_python import psp import os from lxml import etree TREEPKG_DIR = os.path.join(os.path.dirname(__file__), "treepkgs") def index(req): req.content_type = 'text/html;charset=utf-8' template = psp.PSP(req, filename='templates/overview.html') descriptions = [] for f in os.listdir(TREEPKG_DIR): d = os.path.join(TREEPKG_DIR, f) if not os.path.isdir(d): continue treepkg_xml = os.path.join(d, "treepkg.xml") if not os.path.isfile(treepkg_xml): continue xml = None try: xml = open(treepkg_xml, "rb") dom = etree.parse(xml) finally: if xml: xml.close() description = ''.join(dom.xpath("//description/text()")) descriptions.append((os.path.basename(d), description)) template.run({ 'page_title' : 'Free Software forestry', 'back_link' : '/', 'descriptions': descriptions })