-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to compose a template via subclass #345
base: master
Are you sure you want to change the base?
Conversation
e8fc956
to
517f1d5
Compare
if not self.get('expression'): | ||
return None | ||
|
||
return Expression(self['expression'], client=self._client).evaluate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is 👍
else: | ||
self.refresh_from(self.request('patch', self.instance_url(), | ||
data=self.serialize(self))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this
@@ -45,6 +46,9 @@ def __init__(self, id=None, **params): | |||
if id: | |||
self[self.ID_ATTR] = id | |||
|
|||
for k, v in list(params.items()): | |||
self[k] = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this moved from somwehere?
Adds the ability to define templates as (very limited) classes rather than JSON. The main benefit is making it easier to create unit tests, and to write expressions with syntax highlighting.
Example of a template with pytest tests: