Uninstalling Silva Layout does not remove silva-layout metadata set

Bug #108301 reported by Samuel Schluep
4
Affects Status Importance Assigned to Milestone
Silva
Fix Released
Undecided
Eric Casteleijn

Bug Description

After uninstalling Silva Layout and removing it from the Products directory an Attribute Error will be returned when accessing the tab_settings (tab 'properties' > button 'settings...') of the Silva root or a publication. This is probably due to the fact that uninstalling Silva Layout does not remove its metadata sets 'silva-layout' and 'silva-layout-vhost-root'.

Traceback (innermost last):
  Module ZPublisher.Publish, line 112, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.FileSystemSite.FSPageTemplate, line 195, in _exec
  Module Products.FileSystemSite.FSPageTemplate, line 134, in pt_render
  Module Products.PageTemplates.PageTemplate, line 104, in pt_render
   - <FSPageTemplate at /dlcms/service_views/Silva/edit/tab_settings used for /dlcms/service_views/Silva/edit/Container/Publication>
  Module TAL.TALInterpreter, line 206, in __call__
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 424, in do_optTag_tal
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 734, in do_defineSlot
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 677, in do_condition
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 477, in do_setLocal_tal
  Module Products.PageTemplates.TALES, line 221, in evaluate
   - URL: file:Silva/views/edit/macro_edit_metadata.pt
   - Line 17, Column 2
   - Expression: <PythonExpr view.get_metadata(content, category=metadata_category) or nothing>
   - Names:
      {'container': <DirectoryViewSurrogate at /dlcms/service_views/Silva/edit>,
       'context': <DirectoryViewSurrogate at /dlcms/service_views/Silva/edit/Container/Publication>,
       'default': <Products.PageTemplates.TALES.Default instance at 0x01422A58>,
       'here': <DirectoryViewSurrogate at /dlcms/service_views/Silva/edit/Container/Publication>,
       'loop': <Products.PageTemplates.TALES.SafeMapping object at 0x02AF3BE8>,
       'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x0140FF30>,
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0x02AF3BE8>,
       'request': <HTTPRequest, URL=http://localhost:8080/dlcms/edit/tab_settings>,
       'root': <Application at >,
       'template': <FSPageTemplate at /dlcms/service_views/Silva/edit/tab_settings used for /dlcms/service_views/Silva/edit/Container/Publication>,
       'traverse_subpath': [],
       'user': admin}
  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
   - __traceback_info__: view.get_metadata(content, category=metadata_category) or nothing
  Module Python expression "view.get_metadata(content, category=metadata_category) or nothing", line 1, in <expression>
  Module Products.FileSystemSite.FSPythonScript, line 108, in __call__
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.FileSystemSite.FSPythonScript, line 164, in _exec
  Module None, line 91, in get_metadata
   - <FSPythonScript at /dlcms/service_views/Silva/edit/get_metadata used for /dlcms/service_views/Silva/edit/Container/Publication>
   - Line 91
  Module Products.SilvaMetadata.Binding, line 89, in renderElementView
  Module Products.SilvaMetadata.Element, line 189, in renderView
  Module Products.Formulator.Field, line 264, in render_view
  Module Products.Formulator.Widget, line 451, in render_view
  Module Products.Formulator.Field, line 118, in get_value
  Module Products.Formulator.TALESField, line 44, in __call__
  Module Products.PageTemplates.TALES, line 221, in evaluate
   - Expression: <PythonExpr [('not set (acquire setting)', '')] + modules['Products'].SilvaLayout.helpers.getAvailableSkins()>
   - Names:
      {'default': <Products.PageTemplates.TALES.Default instance at 0x01422A58>,
       'field': <ListField at /dlcms/service_metadata/collection/silva-layout/skin/skin>,
       'form': <MetadataElement at /dlcms/service_metadata/collection/silva-layout/skin>,
       'here': <MetadataElement at /dlcms/service_metadata/collection/silva-layout/skin>,
       'loop': <Products.PageTemplates.TALES.SafeMapping object at 0x02E386E8>,
       'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x0140FF30>,
       'nothing': None,
       'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0x02E386E8>,
       'request': <HTTPRequest, URL=http://localhost:8080/dlcms/edit/tab_settings>}
  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
   - __traceback_info__: [('not set (acquire setting)', '')] + modules['Products'].SilvaLayout.helpers.getAvailableSkins()
  Module Python expression "[('not set (acquire setting)', '')] + modules['Products'].SilvaLayout.helpers.getAvailableSkins()", line 1, in <expression>
AttributeError: 'module' object has no attribute 'SilvaLayout'

Tags: silva-1.6
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Unfortunately there's no API in place to easily remove metadata sets. Usually that's no problem, because by themselves they really shouldn't be doing anything. I think that's the case here too, and there's something else that's not removed that is triggering this. Looking at that now.

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Ok, it definitely is the metadata sets themselves, the rendering of the form breaks, because that uses python logic. So we do need an uninstall mechanism for metadata.

Revision history for this message
Samuel Schluep (schluep) wrote :

When uninstalling Silva dLMCS, metadata sets are 'removed'. That is, the mapping of metadata sets to content types is reset and the metadata sets are deleted. However, it does not remove the metadata items of the sets already attached to the content objects. In my experience this is good, because the data remains when refreshing a product.

Revision history for this message
Samuel Schluep (schluep) wrote :

What I forgot to say, you may want to take a look at dLCMS how one could uninstall metadata sets.

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Yeah, cool, I'll steal your code for SilvaLayout, and put it into Silva 2.0 as API, if it's not too much work :)

Revision history for this message
Eric Casteleijn (thisfred) wrote :

fixed

Changed in silva:
assignee: nobody → thisfred
status: Unconfirmed → Fix Committed
Changed in silva:
milestone: none → 2.0
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.