Ticket #687 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

jinja2 'path_to_root' is undefined in directory listings

Reported by: tfogal Owned by:
Priority: major Milestone: 0.8.0
Version: master Keywords: jinja
Cc:

Description

With current master (faf85da440d04d459ebd3a9086efef0db6658dc2), I've created a directory in $MASTER_BASEDIR/public_html named "devbuilds". I use this in a FileUpload? step to place a packaged version of our software.

Trying to view the directory in a browser results in a jinja2 exception, however:

 <class 'jinja2.exceptions.UndefinedError'>: 'path_to_root' is undefined

This appears to come from /status/web/templates/layout.html, line 31 in block "header":

 29    <a href="{{ path_to_root }}buildslaves">Buildslaves</a>
 30    <a href="{{ path_to_root }}changes">Changesources</a>
 31    - <a href="{{ path_to_root }}about">About</a>
 32  </div>

Change History

comment:1 Changed 2 years ago by dustin

  • Version changed from 0.7.11 to master (give git sha1)
  • Type changed from undecided to defect
  • Milestone changed from undecided to 0.8.0

How did that template come into play in a different directory?

comment:2 Changed 2 years ago by Nicolas

  • Keywords jinja added

comment:3 Changed 2 years ago by Dustin J. Mitchell

  • Status changed from new to closed
  • Resolution set to fixed

add a path_to_root key so that directory listings render properly (fixes #687)

Changeset: 02b25d5da13574cda3eb9d2353fcbbd72741c9ab

comment:4 Changed 2 years ago by marcusl

Doh. I've never tested the directory listing view during my Jinja hacking, as I have no directories to list. Stefan added it and I haven't looked at it since. Sorry.

Thanks for the fix Dustin. I reckon we should move the getContext() to WebStatus?() or somewhere, to make it easily accessible to all Resource-classes.

comment:5 Changed 2 years ago by dustin

good idea - #688

Note: See TracTickets for help on using tickets.