Fix SerializingHTMLBuilder has been crashed if jinja2 helper functions are installed.

This commit is contained in:
Takeshi KOMIYA 2018-05-23 01:42:54 +09:00
parent 76acc4775a
commit 1013038b02

View File

@ -13,6 +13,7 @@ import codecs
import posixpath
import re
import sys
import types
import warnings
from hashlib import md5
from os import path
@ -1410,6 +1411,11 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder):
# actually rendered
self.app.emit('html-page-context', pagename, templatename, ctx, event_arg)
# make context object serializable
for key in list(ctx):
if isinstance(ctx[key], types.FunctionType):
del ctx[key]
ensuredir(path.dirname(outfilename))
self.dump_context(ctx, outfilename)