collective / collective.nitf

A Dexterity-based content type inspired on the News Industry Text Format specification
8 stars 3 forks source link

Portlet latest sectionable nitf have a bug with rendering #196

Closed cleberjsantos closed 7 years ago

cleberjsantos commented 7 years ago

The portlet inlcuded in the package have a bug in rendering, but, seeing for this issue #132 , I think be good idea to remove it from current version.

Traceback.

File "/home/xxx/xxx.portal/eggs/collective.nitf-2.1b1-py2.7.egg/collective/nitf/portlets/latest_sectionable_nitf.py", line 177, in getResults
    uid=uid)
  File "/home/xxx/xxx.portal/eggs/collective.nitf-2.1b1-py2.7.egg/collective/nitf/portlets/latest_sectionable_nitf.py", line 80, in render
    return self.template(results=results, pretty_date=pretty_date)
AttributeError: 'SimpleViewClass from /home/xxx/xxx.portal/eg' object has no attribute 'template'
> /home/xxx/xxx.portal/eggs/collective.nitf-2.1b1-py2.7.egg/collective/nitf/portlets/latest_sectionable_nitf.py(80)render()
-> return self.template(results=results, pretty_date=pretty_date)
(Pdb) c
2017-02-24 14:30:25 ERROR Zope.SiteErrorLog 1487957425.660.223035041276 http://127.0.0.1:8089/Plone/noticias/teste.html/view
Traceback (innermost last):
  Module Products.PloneFormGen.patches, line 21, in safe_render
  Module zope.browserpage.viewpagetemplatefile, line 83, in __call__
  Module zope.browserpage.viewpagetemplatefile, line 51, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module zope.pagetemplate.pagetemplate, line 240, in __call__
  Module zope.tal.talinterpreter, line 271, in __call__
  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 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 zope.tales.tales, line 696, in evaluate
   - URL: /home/xxx/xxx.portal/eggs/collective.nitf-2.1b1-py2.7.egg/collective/nitf/portlets/latest_sectionable_nitf.pt
   - Line 74, Column 8
   - Expression: <PythonExpr (view.getResults(section))>
   - Names:
      {'args': (),
       'context': <NITF at /Plone/noticias/teste.html>,
       'default': <object object at 0x7f43b0b6f500>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <HTTPRequest, URL=http://10.1.255.51:8089/Plone/noticias/teste.html/view>,
       'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x7f438ba13050>,
       'view': <collective.nitf.portlets.latest_sectionable_nitf.Renderer object at 0x7f4383dd60d0>,
       'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x7f4383b80390>}
  Module zope.tales.pythonexpr, line 59, in __call__
   - __traceback_info__: (view.getResults(section))
  Module <string>, line 1, in <module>
  Module collective.nitf.portlets.latest_sectionable_nitf, line 177, in getResults
  Module collective.nitf.portlets.latest_sectionable_nitf, line 80, in render
AttributeError: 'SimpleViewClass from /home/xxx/xxx.portal/eg' object has no attribute 'template'
> /home/xxx/xxx.portal/eggs/collective.nitf-2.1b1-py2.7.egg/collective/nitf/portlets/latest_sectionable_nitf.py(80)render()
-> return self.template(results=results, pretty_date=pretty_date)
(Pdb) c

Solution.

collective/nitf/portlets/latest_sectionable_nitf.py

@@ -19,7 +19,9 @@
 class NitfFilterList(BrowserView):
+
+    template = ViewPageTemplateFile('nitf_filter_list.pt')
+

collective/nitf/portlets/configure.zcml

@@ -19,7 +19,6 @@
       for="*"
       name="nitf-filter-list"
       class=".latest_sectionable_nitf.NitfFilterList"
-      template="nitf_filter_list.pt"
       permission="zope2.View"
       />
hvelarde commented 7 years ago

in fact, I want to remove the portlet completely from the package; what do you think?

cleberjsantos commented 7 years ago

I think what we can keep the portlet in the package, but think makes more sense as it's in the redebrasilatual, what does not use selected box for sections.

captura de tela 2017-02-27 15 18 10

hvelarde commented 7 years ago

that's not this portlet but a custom one; we already have #132 to deal with the portlet removal.