Ticket #394 (new enhancement)
Opened 3 years ago
Allow custom loaders to also plug in custom AstTransformers
|Reported by:||Carsten Klein <carsten.klein@…>||Owned by:||cmlenz|
The current API does not allow templates to override the default AstTransformer?? defined in astutil#_compile.
However, classes derived from Code do allow overriding the default transformer.
It would be nice to have a custom loader also incorporate a custom AstTransformer??.
The main concern here is security, effectfully limiting python API access by a custom AstTransformer??.
As I see it, the markup template's init method would require an additional named parameter that by default would be set to none, e.g. xform=None.
That way, upon instantiation of either Suite or Expression, the specified AstTransformer?? could be passed as an alternative the the default transformer.
This would also be backwards compatible, so existing applications would not break.
See the attached patch which might provide such a solution.
The patch is currently untested.