You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
class PalmContext(Context):
def __getattribute__(self, attr):
try:
return Context.__getattribute__(self, attr)
except Exception as parent_exception:
try:
return self.obj.__getattribute__(self.obj, attr)
except:
raise parent_exception
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?
I have searched the existing issues
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: