object_lookup error when icon for mime type is not defined

Bug #616620 reported by Marc Petitmermet
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Silva
Fix Released
Medium
Sylvain Viollon

Bug Description

when i try to link to a object and a .docx document is present in the same folder the lookup window shows "An error happened". it seems that there is a problem with rendering the icon in the lookup window.

after adding the line below in Products.Silva-2.2-py2.4.egg/Products/Silva/__init__.py the error was gone:

('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'file_doc.png'),

precociously i also added these lines:

('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'file_xls.png'),
('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'file_ppt.png'),

but in my opinion there should be a graceful fallback when the mime type is not known. this seems to work in the edit tab but not in the lookup window.

------------------------------------------------------------------------------------------------------------------
2010-08-12T07:04:12 ERROR Zope.SiteErrorLog 1281589452.230.226512039255 https://foo.com/@@object_lookup
Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module Products.Silva.browser.lookup, line 60, in __call__
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.PageTemplates.PageTemplateFile, line 126, in _exec
  Module Products.PageTemplates.PageTemplate, line 98, in pt_render
  Module zope.pagetemplate.pagetemplate, line 115, in pt_render
   - Warning: Macro expansion failed
   - Warning: exceptions.KeyError: 'macro_vein_navigation'
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 534, in do_optTag_tal
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 891, in do_useMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 949, in do_defineSlot
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 855, in do_condition
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 824, in do_loop_tal
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 534, in do_optTag_tal
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 201, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: object_lookup
   - Line 371, Column 30
   - Expression: <PythonExpr (view.renderIcon(asset))>
   - Names:
      {'container': <Silva Publication instance foo>,
       'context': <Silva Publication instance foo>,
       'default': <object object at 0x2b0008a0e200>,
       'here': <Silva Publication instance foo>,
       'loop': {'asset': <Products.PageTemplates.Expressions.PathIterator object at 0x1eb06190>},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x1e8b2b90>,
       'request': <HTTPRequest, URL=https://foo.com/@@object_lookup>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0x1e52cd50>,
       'traverse_subpath': [],
       'user': <LDAPUser 'bar'>,
       'view': <Products.Five.metaclass.ObjectLookup object at 0x1eaab850>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x1e8c3110>}
  Module zope.tales.pythonexpr, line 59, in __call__
   - __traceback_info__: (view.renderIcon(asset))
  Module <string>, line 0, in ?
  Module Products.Silva.browser.lookup, line 74, in renderIcon
AttributeError: 'module' object has no attribute 'RegistryError'

Revision history for this message
Sylvain Viollon (thefunny) wrote :

I fixed both issues in SVN (add mimetypes, and fix the RegistryError).

Changed in silva:
assignee: nobody → Sylvain Viollon (thefunny)
importance: Undecided → Medium
milestone: none → 2.2.1
status: New → Fix Committed
Kit Blake (kitblake)
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.