plone / plone.behavior

Support for "behaviors", used by plone.dexterity
https://pypi.python.org/pypi/plone.behavior
3 stars 2 forks source link

PLIP 20239: Behavior name in ZCML directive, registration lookup utility #2

Closed rnixx closed 9 years ago

rnixx commented 9 years ago

According to http://comments.gmane.org/gmane.comp.web.zope.plone.devel/34834 this pull request introduces behavior short names which are set at ZCML registration time and should later be used for behavior lookup on dexterity content and for behavior introspection.

This change is 100% B/C and only logs a warning at instance startup if a behavior registration has no name set.

More to come in downstream packages

cheers

davisagli commented 9 years ago

What if I want to replace a core behavior, so that every time code looks it up by name it gets my replacement behavior instead of the core one? Doesn't look like that is possible with this implementation.

jensens commented 9 years ago

@do3cc +1 for the fallback

@davisagli at the moment you have to register a new behavior too - which gets a new name by __identifier__ - so nothing changes or do i oversee something? Do you request a new feature?

jensens commented 9 years ago

First I rebased master and now I took care to always register the __identifier__ and if given the name. That way nothing breaks. Todo: add this to the examples in README.rst.

jensens commented 9 years ago

Lets get jenkins opinion about this http://jenkins.plone.org/view/All/job/pull-request/136/

jensens commented 9 years ago

State here: full documentation in README.rst missing (down in ZCML and examples section.

jensens commented 9 years ago

Documentation for name was added to README.rst. tests are running here: http://jenkins.plone.org/job/pull-request/162/

http://jenkins.plone.org/view/All/job/pull-request-4.3/24/

jensens commented 9 years ago

http://jenkins.plone.org/job/pull-request-5.0/54/ http://jenkins.plone.org/job/pull-request-4.3/51/

jensens commented 9 years ago

tests ok

mauritsvanrees commented 9 years ago

When I start my plone-coredev 4.3 buildout, I now get these warnings:

2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Name from title' if no 'factory' is given has no effect and is superfluous.
2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Name from file name' if no 'factory' is given has no effect and is superfluous.
2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Navigation root' if no 'factory' is given has no effect and is superfluous.
2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Exclude From navigation' if no 'factory' is given has no effect and is superfluous.
2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Next previous navigation toggle' if no 'factory' is given has no effect and is superfluous.
2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Allow discussion' if no 'factory' is given has no effect and is superfluous.
2015-07-29 23:09:55 WARNING plone.behavior Specifying 'for' in behavior 'Next previous navigation' if no 'factory' is given has no effect and is superfluous.

Two things:

  1. coredev 4.3 pins plone.behavior 1.0.3, but checks out the master branch. We should probably create a 1.0.x branch and use that on 4.3. Right? (I can do that.)
  2. Alternatively, should we fix those warnings in the various packages?
jensens commented 9 years ago

+1 to fix them, its a wrong registration (predicting to bind for something that has no effect), the change just shows it, nothing new.

jensens commented 9 years ago

PR at plone/plone.app.dexterity/pull/174