Apply dictionary update in the right place for jinja templates
authorMagnus Hagander <magnus@hagander.net>
Tue, 16 Oct 2018 08:51:52 +0000 (10:51 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 16 Oct 2018 08:51:52 +0000 (10:51 +0200)
If we want the context.override.json file to actually override, we have
to load it last, not first.

postgresqleu/confreg/jinjafunc.py

index b14bc17c63d6ae924535d045a7631ae1c53e43ca..a743b5c214fe467e5522b538d13444ef05e0a59a 100644 (file)
@@ -254,6 +254,9 @@ def render_jinja_conference_response(request, conference, pagemagic, templatenam
                c['githash'] = find_git_revision(conference.jinjadir)
 
 
+       if dictionary:
+               c.update(dictionary)
+
        # For local testing, there may also be a context.override.json
        if conference and conference.jinjadir and os.path.exists(os.path.join(conference.jinjadir, 'templates/context.override.json')):
                try:
@@ -262,8 +265,6 @@ def render_jinja_conference_response(request, conference, pagemagic, templatenam
                except Exception:
                        pass
 
-       if dictionary:
-               c.update(dictionary)
        c.update(settings_context_unicode())
 
        return HttpResponse(t.render(**c), content_type='text/html')