Skip to content

[FEATURE] Template support for pulp-content #8006

Description

@fabiang

Hello Pulp team,

first things first: Pulp is an awesome tool for software distribution.

I see that the Jinja template for pulp-content is hardcoded at:

template = Template(
"""
<html>
<head><title>Index of {{ path }}</title></head>
<body bgcolor="white">
<h1>Index of {{ path }}</h1>
<hr><pre>
{%- if not root %}<a href="../">../</a>{% endif %}
{% for name in dir_list -%}
{% if dates.get(name, "") -%}
{% set date = dates.get(name).strftime("%d-%b-%Y %H:%M") -%}
{% else -%}
{% set date = "" -%}
{% endif -%}
{% if name in sizes -%}
{% set size | filesizeformat -%}
{{ sizes.get(name) }}
{% endset -%}
{% else -%}
{% set size = "" -%}
{% endif -%}
<a href="./{{ name|e }}">{{ name|e }}</a>{% for number in range(100 - name|e|length) %} """
"""{% endfor %}{{ date }} {{ size }}
{% endfor -%}
</pre><hr></body>
</html>
"""

Instead of this hardcoded template, I want to customize the content page per Pulp domain. Currently this is only possible by patching the source code. A possible solution would be to have a custom directory with Jinja templates (e.g. which I can mount as docker volume) with the following files:

  • default.j2
  • domain1.j2
  • domain2.j2

where default.j2 is the default template for all domains or when domains aren't enabled at all.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions