Hello Samuele,
> In data lunedì 16 dicembre 2013 09:56:55, Ferran Jorba ha scritto:
>> > In this way we're going to have the whole stack trace with all the
>> > offending values.
sorry for not answering before, I was busy with other issues.
Your suggestion to wrap acc_find_possible_actions between a try/except
was very useful. That's what I got:
** Traceback details
Traceback (most recent call last):
File "/home/ddd/lib/python/invenio/access_control_admin.py", line 1524, in
acc_find_possible_actions
for row in arglistids[a][keywords[0]]:
KeyError: 'act'
** Stack frame details
Frame acc_find_possible_actions in
/home/ddd/lib/python/invenio/access_control_admin.py at line 1564
a = '-1'
arglistids = "{-1: {'categ': ['*']}}"
res = "[-1, 'categ', '*']"
res2 = "[[-1, 'categ', '*'], [-1, 'categ', '*']]"
res3 = '[]'
res1 = "((-1, 'categ', '*'), (-1, 'categ', '*'))"
id_action = '12L'
value = "'*'"
r = "'*'"
kw = "'categ'"
next_arglistid = '[]'
keywords = "['act', 'categ', 'doctype']"
register_exception = '<function register_exception at
0x7f4036193c08>'
id_role = "'1'"
However, I didn't know how to debug it further, as the logic is too
hairy for me. What I have done is to catch and skip the inner error
(patch attached), and now we are able to work on our permissions.
So, may I ask a couple of questions?
1. Do you have any suggestion to find the «KeyError: 'act'» cause? I'd
like to go to the root of the problem.
2. Do you think it is safe to keep on working with our patch, meanwhile?
Thanks again, and have a nice 2014!
Ferran
---
lib/python/invenio/access_control_admin.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/python/invenio/access_control_admin.py b/lib/python/invenio/access_control_admin.py
index 4ba8e84..40106fd 100644
--- a/lib/python/invenio/access_control_admin.py
+++ b/lib/python/invenio/access_control_admin.py
@@ -1519,8 +1519,11 @@ def acc_find_possible_actions(id_role, id_action):
# fill a list with the new entries, shortcut and copying first
# keyword list
next_arglistid = []
- for row in arglistids[a][keywords[0]]:
- next_arglistid.append([a, row[:] ])
+ try:
+ for row in arglistids[a][keywords[0]]:
+ next_arglistid.append([a, row[:] ])
+ except KeyError:
+ pass
# run through the rest of the keywords
for kw in keywords[1:]:
if not arglistids[a].has_key(kw):