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

Abstract properties of Filter #44

Closed
mottosso opened this issue Aug 20, 2014 · 4 comments
Closed

Abstract properties of Filter #44

mottosso opened this issue Aug 20, 2014 · 4 comments
Labels

Comments

@mottosso
Copy link
Member

It just occured to me that the mandatory properties of Filter et. al. should really be abstract properties. E.g.

class Filter(object):
    @abc.abstractproperty
    def families(self):
        pass

So that whomever implements a plugin, will also have to implement the properties. E.g.

class MyFilter(Filter):
    @property
    def families(self):
        return ['maya']

At the moment, you could implement a plugin, but forget about these properties which would make your plugin not work.

edited: Typo

@mottosso mottosso added the bug label Aug 20, 2014
@tokejepsen
Copy link
Member

So that would be for families and hosts?

@mottosso
Copy link
Member Author

So far, yes. And any other mandatory properties we'll end up with.

@mottosso
Copy link
Member Author

Reopening this due to @properties not being accessible in classes that hasn't been instantiated yet, resulting in messier code.

# E.g.
for PluginClass in publish.plugin.discover():
    plugin = PluginClass(instance)
    assert plugin.hosts == ['maya']

# As opposed to:
for plugin in publish.plugin.discover():
    assert plugin.hosts == ['maya']

And in cases where the plugin takes different arguments, such as the Selector taking a Context and the Validator taking an Instance, further checks has to be made prior to getting hosts and families. It'd be more efficient if we could check compatibility before doing any instantiation, as was the case prior to this adjustment.

Thoughts?

@mottosso mottosso reopened this Aug 23, 2014
@mottosso
Copy link
Member Author

This has been restored to non-properties due to the above explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants