[Buildbot-devel] jinja: user customization and public_html?

Marcus Lindblom macke at yar.nu
Mon Dec 21 10:25:27 UTC 2009


On 2009-12-20 23:28, Stefan Seefeld wrote:
> On 12/20/2009 11:29 AM, Marcus Lindblom wrote:
>> On 2009-12-20 17:10, Dustin J. Mitchell wrote:
>>
>>> Sorry to self-reply, but I think I answered my own question, on
>>> finding this snippet in web/baseweb.py:
>>>
>>>            default_loader = jinja2.PackageLoader('buildbot.status.web',
>>> 'templates')
>>>            root = os.path.join(os.getcwd(), 'templates')
>>>            loader = jinja2.ChoiceLoader([jinja2.FileSystemLoader(root),
>>>                                          default_loader])
>>>            self.templates = jinja2.Environment(loader=loader,
>>>                                                extensions=['jinja2.ext.i18n'],
>>>                                                trim_blocks=True,
>>>                                                undefined=AlmostStrictUndefined)
>>>
>>>   From what I can tell, this means that $basedir/templates can override
>>> built-in templates on a page-by-page basis, right?
>>>
>
> Yes.
>
>> Stefan wrote that, but what I think is, that it tries to load from an
>> egg first (PackageLoader), then use the FileSystemLoader to load
>> directly from disk.
>>
>
> The idea is to system-wide templates be provided with the buildbot
> installation, but allow a buildbot instance to override them (selectively).

>> > So.. nope, you won't get that by default... but we could probably add
>> > chain another ChoiceLoader into there that looks somewhere where the
>> > user could put his/her custom HTML, to override specific files. (one, a
>> > few or all.)
>> >
> Who is 'the user' here ? Is it the person who runs the buildbot instance
> ?  Why aren't instance-specific templates enough ? (I assume the user
> who runs the instance is  the one who starts the buildbot master
> process, which ultimately loads the templates.)

Ooops.  os.getcwd() is the master. I mistakenly thought that was for 
reading from the buildbot source dir.

So, everything works just fine then. Instance-specific templates are 
already in there, and will override selectively. (Except for index.html, 
see my previous post.)

Sorry for the confusion. :-|

Cheers,
/Marcus





More information about the devel mailing list