Skip to content
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

Allow custom resource constructor args #181

Merged
merged 3 commits into from
Sep 29, 2020

Conversation

multimeric
Copy link
Contributor

For example, this lets you do:

class TestResource(ResourceDetail):
    """ 
    This fake resource always renders a constructor parameter
    """ 
    def __init__(self, *args, **kwargs):
        super().__init__()
        self.constant = kwargs.get('constant')

    def get(self):
        return self.constant

api.route(TestResource, 'resource_kwargs', '/resource_kwargs', resource_kwargs={
    'constant': 'hello!'
})

Basically this is helpful if you ever want to fully customize a resource object.

@coveralls
Copy link

coveralls commented Nov 15, 2019

Coverage Status

Coverage increased (+0.01%) to 90.786% when pulling 3de105d on TMiguelT:resource_init_args into b44bc08 on miLibris:master.

@akira-dev akira-dev merged commit c106169 into miLibris:master Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants