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

fix nbconvert filter validation #3512

Merged
merged 2 commits into from Jul 2, 2013
Merged

Conversation

jakevdp
Copy link
Contributor

@jakevdp jakevdp commented Jul 2, 2013

Fixes issue #3505

@jakevdp
Copy link
Contributor Author

jakevdp commented Jul 2, 2013

It still might be cleaner to replace this block with a call to register_filter, but there are some differences between the two that may be deliberate. For example, is there a reason the code here is checking for a subclass of MetaHasTraits rather than an instance of MetaHasTraits?

@minrk
Copy link
Member

minrk commented Jul 2, 2013

I think it's checking the subclass because config will specify that as a class, rather than an instance of that class. This isn't how most of IPython works when specifying classes for things, so there might be a better way.

@Carreau
Copy link
Member

Carreau commented Jul 2, 2013

It still might be cleaner to replace this block with a call to register_filter, but there are some differences between the two that may be deliberate. For example, is there a reason the code here is checking for a subclass of MetaHasTraits rather than an instance of MetaHasTraits?

Hi jake, Sorry I was not able to respond to you earlier, and is not able to improve nbconvert a lot those day.
I'm not sure there is a reason to check for isSubClass rather than isInstance ( I still need to look again on how those will work with Configurable). At least there are no reason to treat predefined and user filter differently.

@jakevdp
Copy link
Contributor Author

jakevdp commented Jul 2, 2013

As I think about it more, I think the issubclass call is in error. Why would you ever pass a subclass of a metaclass as a filter? An instance of a metaclass is a class, so we should be checking for isinstance here.

@minrk
Copy link
Member

minrk commented Jul 2, 2013

ok, then go ahead and make the change. I was thinking of it as the plain HasTraits, when really the logic guarded by the check here expects issubclass(Configurable).

@Carreau
Copy link
Member

Carreau commented Jul 2, 2013

Agreed with Min. issubclass is a mistake, if you have time, adding tests is a welcomed addition :-)

@minrk
Copy link
Member

minrk commented Jul 2, 2013

I think @jdfreder is getting started putting the test suite together, so maybe wait for that before committing a test to avoid conflict.

@Carreau
Copy link
Member

Carreau commented Jul 2, 2013

I think @jdfreder is getting started putting the test suite together, so maybe wait for that before committing a test to avoid conflict.

Ah, my bad, I though the test were added before merging. @jakevdp apparently pushed new commits a few minutes ago that seem ok to me.

@minrk
Copy link
Member

minrk commented Jul 2, 2013

Yup, fine for now.

@Carreau
Copy link
Member

Carreau commented Jul 2, 2013

Ok, merging.

Carreau added a commit that referenced this pull request Jul 2, 2013
fix nbconvert filter validation
@Carreau Carreau merged commit f4769da into ipython:master Jul 2, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
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

3 participants