| Index: cms/converters.py |
| =================================================================== |
| --- a/cms/converters.py |
| +++ b/cms/converters.py |
| @@ -308,6 +308,7 @@ |
| "get_page_content": self.get_page_content, |
| } |
| + self._module_refs = [] |
| for dirname, dictionary in [("filters", filters), ("globals", globals)]: |
| for filename in self._params["source"].list_files(dirname): |
| root, ext = os.path.splitext(filename) |
| @@ -327,11 +328,8 @@ |
| # HACK: The module we created here can be garbage collected because it |
| # isn't added to sys.modules. If a function is called and its module is |
| # gone it might cause weird errors (imports and module variables |
| - # unavailable). We avoid this situation by explicitly referencing the |
| - # module from the function so they can only be garbage collected |
| - # together. |
| - if callable(dictionary[name]): |
| - dictionary[name].module_ref = module |
| + # unavailable). We avoid this situation by keeping a reference. |
| + self._module_refs.append(module) |
| self._env = jinja2.Environment(loader=self._SourceLoader(self._params["source"]), autoescape=True) |
| self._env.filters.update(filters) |