I'm using a Cookiecutter Pyramid web development framework. This has three linked files:
utils.py - defines the random cache string to add to an url
views.py - passes utils functions to chameleon template
layout.pt - chameleon template calling static css urls etc.
In layout.pt pre-cache-busting there is a link that says:
<link href="${request.static_url('pycharm_app:static/theme.css')}" rel="stylesheet">
I'm trying to edit this link to call the build_cache_id function as so:
<link href="/static/theme.css?cacheId=${build_cache_id('/static/theme.css')}" rel="stylesheet">
but get error:
NameError: build_cache_id
- Expression: "build_cache_id('/static/theme.css')"
- Filename: ... s/first_business_website/pycharm_app/templates/layout.pt
- Location: (line 17: col 43)
- Source: ... ss?cacheId=${build_cache_id('/static/theme.css')}" rel="styl ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Expression: "load: layout.pt"
- Filename: ... rst_business_website/pycharm_app/templates/mytemplate.pt
- Location: (line 1: col 22)
- Source: <div metal:use-macro="load: layout.pt">
^^^^^^^^^^^^^^^
- Arguments: view: <function my_view at 0x109eff8b0>
renderer_name: ../templates/mytemplate.pt
renderer_info: <RendererHelper - at 0x109f3f040>
context: <DefaultRootFactory None at 0x109d3faf0>
request: <Request - at 0x109d3fa90>
req: <Request - at 0x109d3fa90>
get_csrf_token: <partial - at 0x109f32db0>
project: pycharm_app
target_language: <NoneType - at 0x10817de60>
repeat: {...} (0)
macroname: load: layout.pt