Skip to content

Commit

Permalink
Fix templates without separate distro release
Browse files Browse the repository at this point in the history
Signed-off-by: Jiří Janoušek <[email protected]>
  • Loading branch information
jiri-janousek committed Oct 18, 2017
1 parent 3a2d5b6 commit dcfabb3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nuvola_index/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,20 @@ def build_nuvola_for_distro(self, distro: Dict[str, Any] = None, release: Dict[s
if not release and releases:
release = releases[0]

templates = []
if not release:
distro_spec = "/%s" % distro["id"]
template = "nuvola_%s.html" % distro["id"]
else:
distro_spec = "/%s/%s" % (distro["id"], release["id"])
template = "nuvola_%s_%s.html" % (distro["id"], release["id"])
templates.append("nuvola_%s_%s.html" % (distro["id"], release["id"]))
templates.append("nuvola_%s.html" % distro["id"])
templates.append("nuvola.html")

canonical_path = "/nuvola%s/" % distro_spec
target = os.path.join(self.output_dir, "nuvola%s/index.html" % target)
os.makedirs(os.path.dirname(target), exist_ok=True)
with open(target, "wt") as f:
f.write(self.templater.render([template, "nuvola.html"], {
f.write(self.templater.render(templates, {
"tab_target": "/nuvola",
"distributions": self.distributions,
"apps": self.apps,
Expand Down

0 comments on commit dcfabb3

Please sign in to comment.