mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix SerializingHTMLBuilder has been crashed if jinja2 helper functions are installed.
This commit is contained in:
parent
76acc4775a
commit
1013038b02
@ -13,6 +13,7 @@ import codecs
|
|||||||
import posixpath
|
import posixpath
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import types
|
||||||
import warnings
|
import warnings
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from os import path
|
from os import path
|
||||||
@ -1410,6 +1411,11 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder):
|
|||||||
# actually rendered
|
# actually rendered
|
||||||
self.app.emit('html-page-context', pagename, templatename, ctx, event_arg)
|
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))
|
ensuredir(path.dirname(outfilename))
|
||||||
self.dump_context(ctx, outfilename)
|
self.dump_context(ctx, outfilename)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user