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 ModelOptions to have extra parameters #449

Closed
wants to merge 1 commit into from

Conversation

rmb938
Copy link
Contributor

@rmb938 rmb938 commented Sep 17, 2016

Closes #397

ModelOptions can now have extra parameters. This only applies to params that start with '_'

Usage:

>>> class Foo(Model):
...     class Options:
...         _test = 123
... 
>>> Foo.Options._test
123
>>> Foo._options._test
123

@rmb938
Copy link
Contributor Author

rmb938 commented Oct 11, 2016

@bintoro Can I get some feedback on this and possibly get it merged & released?

@rmb938 rmb938 mentioned this pull request Dec 8, 2016
@lkraider
Copy link
Contributor

You already can set your own options class (just inherit from ModelOptions SchemaOptions):

class FooOptions(SchemaOptions):
    def __init__(self, test=None, **kwargs):
        super(FooOptions, self).__init__(**kwargs)
        self.test = test

class Foo(Model):
    __optionsclass__ = FooOptions
    class Options:
        test = 123

@lkraider lkraider closed this Mar 16, 2017
@lkraider
Copy link
Contributor

Thanks for the PR, let me know if somehow your use case is not catered by the custom class.

lkraider added a commit that referenced this pull request Feb 13, 2018
@lkraider
Copy link
Contributor

Thanks, this has been merged now.

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.

None yet

2 participants