Open ethanknox-palmetto opened 3 years ago
I think we can achieve this with click.make_pass_decorator(Environment)
- this documentation has an example: https://click.palletsprojects.com/en/8.0.x/complex/
This is going to get scooped into whatever we do for #40
Context While the interface is still young we could consider simplifying it for readability. since this API is a core user interface for
palm
we probably want it as reads-like-english as possible.Describe the solution you'd like We could potentially capture the context at top level, then monkeypatch
__getattribute__
to make obj the final lookup path. so it would look something like this:then the interface would be
Describe alternatives you've considered it would be trivial to just alias ctx.obj in the template, and that might actually be better for reasons stated below.
Additional context Naming collisions would suck here. this is the kind of magic that makes OOP great. It's also the kind of magic that makes functional programmers hate OOP if something goes wrong here.
Is there an existing feature request for this?