'depends_on' argument of ExtensionRegistry should allow lists as value

Bug #101351 reported by Guido Wesdorp
6
Affects Status Importance Assigned to Milestone
Silva
Fix Released
Wishlist
Unassigned

Bug Description

Currently it's not possible to use the 'depends_on' argument to declare more
than one dependency, in most cases that's fine but for certain situations it
would be nice if one could pass in a list rather then a single string.

For instance, I have this extension (SilvaConferenceExtension) that depends both
on SilvaDocument and on SilvaMySQLMembership, where those extensions don't
depend on each other. Now if I'd set 'SilvaDocument' as the depends_on value,
it's not guaranteed SilvaMySQLMembership has been installed, and if I use
'SilvaMySQLMembership', 'SilvaDocument' might not be installed.

Tags: silva-future
Revision history for this message
Andy Altepeter (aaltepet) wrote :

Is this something you'd like me to work on? I can see the value in this. I've dug into the zcml handlers in 2.0 a bit. Those would need to be adjusted, and perhaps some conflict resolution in the ExtensionRegistry...

Changed in silva:
assignee: nobody → kitblake
Revision history for this message
Kit Blake (kitblake) wrote :

If it's not a lot of work, let's fix this. If it is a lot of work, I'd rather fix in a future project that needs it.

Changed in silva:
assignee: kitblake → aaltepet
Revision history for this message
Andy Altepeter (aaltepet) wrote :

This will be fairly quick (update the depends_on directive, update handlers registration, alter ExtensionRegistry.register).

The most difficult to work out will be ExtensionRegistry._orderExtensions, to figure out how to push the ordering based on multiple depends_on extensions. It's difficult, but should go pretty quickly.

Revision history for this message
Andy Altepeter (aaltepet) wrote :

Note that SilvaNews could take advantage of this feature, since it depends on SilvaExternalSources for it's InlineNewsViewer

Revision history for this message
Andy Altepeter (aaltepet) wrote :

The problem with changing the silva:extension zcml is that the IExtensionDirectory.depends needs to be changed from PythonIdentifier to Tokens(value_type=PythonIdentifier())

BUT, depends also has a default value of u'Silva', which now needs to be [u'Silva']. The problem here is that [u'Silva'] is not hashable (since it's a list), so zope won't startup. If you remove the default parameter, then zope will fail later when a Silva extension (like SilvaDocument) doesn't define depends.

So not sure where to go with this. It would be nice if Tokens extended schema.Tuple instead of schema.List

Revision history for this message
Andy Altepeter (aaltepet) wrote :

committed this into the Silva trunk. The zcml depends_on directive, if present, now requires tuples even if the product only depends on one extension.

The extension registry will work if depends_on parameter is not a list.

NOTE: I would like to expose this information in to the extension service edit tab in the ZMI, so not marking this as fix committed yet. It would be nice if this tab displayed the depends on information, and gave feedback as to whether a required product was available or not.

Revision history for this message
Andy Altepeter (aaltepet) wrote :

Perhaps this information could be output to the error log as a warning?

Revision history for this message
Andy Altepeter (aaltepet) wrote :

not looking at outputting warnings to the error log at this time.

Added dependency lists to the extensions service.

Changed in silva:
milestone: none → 2.1
status: New → Fix Committed
Changed in silva:
assignee: aaltepet → nobody
Changed in silva:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.