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

provides taggedvalue inheritance #144

Merged
merged 4 commits into from
Oct 14, 2019
Merged

Conversation

mamico
Copy link
Member

@mamico mamico commented Oct 9, 2019

provides query/get/list taggedvalue with subclass inheritance
fix: plone/plone.dexterity#57 and similar issues

Copy link
Member

@mgedmin mgedmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMish, but I don't see

  • a changelog update
  • documentation update

Also, is this a backwards-incompatible change (requiring a major version bump), a new feature (requiring a minor version bump), or a bugfix?

@mamico
Copy link
Member Author

mamico commented Oct 10, 2019

LGTMish,

good, thanks.

but I don't see

  • a changelog update

done.

  • documentation update

Also, is this a backwards-incompatible change (requiring a major version bump), a new feature (requiring a minor version bump), or a bugfix?

I ask for your support on that. IMHO it's a bugfix, no changes. The only backwards-incompatible could be if someone expects the current wrong behavior, where tag on a class don't inherits in a subclass...

Copy link
Member

@mgedmin mgedmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

(I'm not sure my review is worth much, given that I've no idea this API existed in zope.interface, despite using it for many years ;)

Copy link
Member

@icemac icemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I think of this change not as a simple bugfix more as a missing feature as you only had to write new code instead of changing existing one (besides in the tests.)

@icemac
Copy link
Member

icemac commented Oct 11, 2019

Coveralls seems to be broken in itself: it lists all files several times.

@mgedmin
Copy link
Member

mgedmin commented Oct 11, 2019

I think of this change not as a simple bugfix more as a missing feature as you only had to write new code instead of changing existing one (besides in the tests.)

There's a difference between overriding an inherited method (to fix behaviour) and adding a new method (to add behaviour), but merely looking at the diff is not enough to distinguish these two cases (which was why I asked).

@icemac
Copy link
Member

icemac commented Oct 11, 2019

@mgedmin Right, I did not look deep enough into the code.

I know and use the tagging features sporadically. The issue which is fixed here has never been a problem for me.
I am not sure if this PR breaks someone's code so let's make the screaming test.

@mamico
Copy link
Member Author

mamico commented Oct 14, 2019

@icemac @mgedmin thanks a lot for the reviews.
This i not an urgent bug, in my opinion, but a bit annoying on cases like plone/plone.dexterity#57 filled by @volkerjaenisch and @jensens.
I ran into the same problem and wasted time to know the cause.
BTW plone dexterity uses extensively schema tagging for field permission, sorting, ...

@jensens
Copy link
Member

jensens commented Oct 14, 2019

This missing inheritance of tagged values always felt like a bug to me, even if one may argue its a missing feature. It is just not what one would expect. Also, it makes life harder than it should.

👍 for merging this.

@icemac
Copy link
Member

icemac commented Oct 14, 2019

@mamico Feel free to merge the PR yourself to prove you signed the Contributor agreement.

@mamico mamico merged commit 33aa0ba into zopefoundation:master Oct 14, 2019
@icemac
Copy link
Member

icemac commented Oct 15, 2019

@mamico Do you need a release of zope.interface to use this feature somewhere?

@mamico
Copy link
Member Author

mamico commented Oct 16, 2019

@mamico Do you need a release of zope.interface to use this feature somewhere?

@icemac as I said above I've workaround. No particular urgency for me. Thanks.

@jamadden
Copy link
Member

jamadden commented Nov 11, 2019

FWIW, this turned out to be a breaking change for us. We apparently had code (in nti.externalization) that implicitly relied on tagged values not being inherited. There's code that examines classes in a module, and if they implement an interface that provides a particular tagged value, a utility is registered with a name from the value of that tag. With 4.7.0, we started registering duplicate utilities because we started finding classes that only implemented a derived interface. Simplified example:

class IPublic(Interface):
    taggedValue('tagged-value', 'public')

class IPrivate(IPublic):
    pass

@implementer(IPublic)
class Public(object): pass

@implementer(IPrivate)
class PrivateImplementation(object): pass

With 4.6, we'd register Public with a name of public. With 4.7, we're trying to register Public with a name of public and PrivateImplementation also with a name of public. This leads to zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions.

I think I can workaround this by calling Element.queryTaggedValue(iface, ...) instead of iface.queryTaggedValue(...)...

(EDIT: Clarified some typos in the sample code.)

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.

Inheritance of form schema hints, not working
5 participants