#5 — File objects: problems when files are not uploaded for all site languages.

by J M Cerqueira Esteves last modified Apr 11, 2011 07:51 AM
State Unconfirmed
Version:
Area Functionality
Issue type Bug
Severity Medium
Submitted by J M Cerqueira Esteves
Submitted on Apr 11, 2011
Responsible
Target release:
Found more bad behavior when a File object has no uploaded files for some of the site languages (actually tested only in a bilingual site, pt & en with pt as default).
If one has chosen to have content type icons shown (at least to logged in users), then:
- content icons in the default folder listing and the folder contents listing seem to be determined exclusively by the file uploaded for the default language (regardless of the language selected when visiting the site);
- if no file has been uploaded for the default language, no content type icon is shown for the File object, again in both listings and regardless of language selection;
- selecting any set of such Files and then clicking the 'change state' button has no problems IF working in the non-default language (and no files lack a content type icon here);
- but selecting a File with no file uploaded for the default language (e.g, above only uploading for 'en') and clicking 'change state' one gets an error page, since an AttributeError is raised ('NoneType' object has no attribute 'getContentType') --- full traceback below;
- using the default language and visiting a File object for which no file has been uploaded for that language, one sees a "None" where normally there would be a link for download --- but I suppose this is for now the expected behaviour, since only fallback to content in the default language is currently supported (issue #3 ).

~~~
Full traceback referred to above (unable to include it as an attachment; maybe some bug at plone.org):

Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 47, in call_object
  Module Products.CMFFormController.FSControllerPageTemplate, line 91, in __call__
  Module Products.CMFFormController.BaseControllerPageTemplate, line 31, in _call
  Module Shared.DC.Scripts.Bindings, line 324, in __call__
  Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 240, in _exec
  Module Products.CMFCore.FSPageTemplate, line 180, in pt_render
  Module Products.PageTemplates.PageTemplate, line 80, in pt_render
  Module zope.pagetemplate.pagetemplate, line 113, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 954, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 858, in do_defineMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 954, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 946, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 821, in do_loop_tal
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 220, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: file:/srv/plone/winston2/buildout-cache/eggs/Plone-4.0.4-py2.6.egg/Products/CMFPlone/skins/plone_forms/content_status_history.cpt
   - Line 155, Column 36
   - Expression: <PathExpr standard:u'item_icon/html_tag'>
   - Names:
      {'container': <PloneSite at /ama_gi>,
       'context': <ATFolder at /ama_gi/tst>,
       'default': <object object at 0xb76366d8>,
       'here': <ATFolder at /ama_gi/tst>,
       'loop': {u'item': <Products.PageTemplates.Expressions.PathIterator object at 0xdb074ec>},
       'nothing': None,
       'options': {'args': (),
                   'state': <Products.CMFFormController.ControllerState.ControllerState object at 0xdc1770c>},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xdbed964>,
       'request': <HTTPRequest, URL=http://[CENSORED]/tst/content_status_history>,
       'root': <Application at >,
       'template': <FSControllerPageTemplate at /ama_gi/content_status_history used for /ama_gi/tst>,
       'traverse_subpath': [],
       'user': <PloneUser 'jmce'>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 157, in _eval
  Module Products.PageTemplates.Expressions, line 119, in render
  Module plone.memoize.instance, line 45, in memogetter
  Module plone.app.layout.icons.icons, line 25, in html_tag
  Module plone.app.layout.icons.icons, line 85, in url
  Module plone.app.blob.content, line 190, in getIcon
AttributeError: 'NoneType' object has no attribute 'getContentType'
Steps to reproduce:
In a Plone 4.0.4 site (configured for showing content type icons to logged in users) with languages pt & en, pt as default one, created 3 File objects in a folder:
- one uploading a PDF file only for pt;
- one uploading a PDF file only for en;
- one uploading PDF files for both languages, pt & en.

No responses can be added.