Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistence of *.html.py file in temporary directory #327

Open
ggemmill opened this issue Dec 28, 2020 · 2 comments
Open

Persistence of *.html.py file in temporary directory #327

ggemmill opened this issue Dec 28, 2020 · 2 comments

Comments

@ggemmill
Copy link

Environment Linux, Mageia 7 x86_64
Mako assumes incorrectly that if a .html.py file exists in the specified temporary directory:
tmpl = Template(filename='weather.html', module_directory='/tmp/mako_modules')
that the template does not need to be re-compiled. I have been testing a development version of a python script alongside the production version, with a slight difference in the template. Mako just uses whichever version was last compiled.

@zzzeek
Copy link
Member

zzzeek commented Dec 28, 2020

hi there -

mako uses the last modification time of the template file + the py file to determine if a recompile is needed. the code that does this is here: https://github.com/sqlalchemy/mako/blob/master/mako/template.py#L404

so check the modification time of your .py file is not perhaps in the future relative to your machine's clock, or something like that.

@UlrichEckhardt
Copy link

I believe this needs to be documented better how this works and that a deployment should purge or at least refresh the modules. I just lost quite some time over a bad cache: The scenario here is an upgrade not of my template files, but of the the ecosystem around it, i.e. going from Python 2 to 3 and upgrading Mako in the run. Needless to say, this failed, since the old cache used Python 2 features not available in 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants