collective / collective/collective.subscribablesections

Error while rendering "Subscription requests" portlet

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

**Problem:**
1) When access to **Subscriptions** tab into a folder flagged as **Open Section** with an user with **Zope Admin** or **Plone Administrator** roles and _without having approved his access request_, in the Zope console show the following error:

``` python
2013-02-16 16:08:34 ERROR portlets Error while rendering
Traceback (most recent call last):
File "/home/macagua/.buildout/eggs/plone.app.portlets-2.3.7-py2.7.egg/plone/app/portlets/manager.py", line 63, in safe_render
return portlet_renderer.render()
File "/home/macagua/proyectos/plone/git/collective.subscribablesections_bnk/collective/subscribablesections/portlets/requests.py", line 49, in render
return self._template()
File "/home/macagua/.buildout/eggs/Zope2-2.13.19-py2.7.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
return self.im_func(im_self, *args, **kw)
File "/home/macagua/.buildout/eggs/Zope2-2.13.19-py2.7.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/home/macagua/.buildout/eggs/zope.pagetemplate-3.5.2-py2.7.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
strictinsert=0, sourceAnnotations=sourceAnnotations)()
File "/home/macagua/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 271, in __call__
self.interpret(self.program)
File "/home/macagua/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
handlers[opcode](self, args)
File "/home/macagua/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
self.no_tag(stuff[-2], stuff[-1])
File "/home/macagua/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 513, in no_tag
self.interpret(program)
File "/home/macagua/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
handlers[opcode](self, args)
File "/home/macagua/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 819, in do_loop_tal
iterator = self.engine.setRepeat(name, expr)
File "/home/macagua/.buildout/eggs/zope.tales-3.5.2-py2.7.egg/zope/tales/tales.py", line 682, in setRepeat
expr = self.evaluate(expr)
File "/home/macagua/.buildout/eggs/zope.tales-3.5.2-py2.7.egg/zope/tales/tales.py", line 696, in evaluate
return expression(self)
File "/home/macagua/.buildout/eggs/zope.tales-3.5.2-py2.7.egg/zope/tales/expressions.py", line 217, in __call__
return self._eval(econtext)
File "/home/macagua/.buildout/eggs/Zope2-2.13.19-py2.7.egg/Products/PageTemplates/Expressions.py", line 155, in _eval
return render(ob, econtext.vars)
File "/home/macagua/.buildout/eggs/Zope2-2.13.19-py2.7.egg/Products/PageTemplates/Expressions.py", line 117, in render
ob = ob()
File "/home/macagua/proyectos/plone/git/collective.subscribablesections_bnk/collective/subscribablesections/portlets/requests.py", line 59, in requests
return self._data()
File "/home/macagua/proyectos/plone/git/collective.subscribablesections_bnk/collective/subscribablesections/portlets/requests.py", line 86, in _data
section = brain.getObject()
File "/home/macagua/.buildout/eggs/Products.ZCatalog-2.13.23-py2.7.egg/Products/ZCatalog/CatalogBrains.py", line 102, in getObject
return parent.restrictedTraverse(path[-1])
File "/home/macagua/.buildout/eggs/Zope2-2.13.19-py2.7.egg/OFS/Traversable.py", line 317, in restrictedTraverse
return self.unrestrictedTraverse(path, default, restricted=True)
File "/home/macagua/.buildout/eggs/Zope2-2.13.19-py2.7.egg/OFS/Traversable.py", line 244, in unrestrictedTraverse
raise Unauthorized(name)
Unauthorized: You are not allowed to access 'acme-company' in this context
```

The same error happen when access to **View my subscriptions** link with the same conditions describes into the **Problem** section in this issue.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in collective/subscribablesections/portlets/requests.py, following render(), requests(), and _data() at the locations named in the traceback. Reproduce the Open Section scenario with an unapproved access request and verify that the Subscription requests portlet and View my subscriptions link no longer raise Unauthorized while rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.