Hi Samuele,
> >> * 2013-12-10 13:15:20 -> KeyError: 'categ'
> >> (access_control_admin.py:1522:acc_find_possible_actions)
> >
> > the categ additional param was introduced in:
> > [...]
I've tried to debut it myself, but I cannot understand the origin of
the error. I've patched access_control_admin.py (see below) and I get this
debug.log message. Does it help?
$ cat /tmp/debug.log
keywords:
['categ', 'doctype']
res2:
[[1, 'act', 'SBI'], [1, 'doctype', 'ARTCIE']]
a:
1
arglistids:
{1: {'doctype': ['ARTCIE']}}
arglistids[a]:
{'doctype': ['ARTCIE']}
a:
1
keywords[0]:
categ
Your help is (still) appreciated. Thanks,
Ferran
---
diff --git a/lib/python/invenio/access_control_admin.py
b/lib/python/invenio/access_control_admin.py index 4ba8e84..0ce653e
100644 --- a/lib/python/invenio/access_control_admin.py
+++ b/lib/python/invenio/access_control_admin.py
@@ -1481,6 +1481,9 @@ def acc_find_possible_actions(id_role, id_action):
# find needed keywords, create header
keywords = acc_get_action_keywords(id_action=id_action)
keywords.sort()
+ with open('/tmp/debug.log', 'a') as f:
+ f.write('\nkeywords:\n')
+ f.write(str(keywords) + '\n')
if not keywords:
# action without arguments
@@ -1498,6 +1501,9 @@ def acc_find_possible_actions(id_role, id_action):
for r in res:
res2[-1].append(r)
res2.sort()
+ with open('/tmp/debug.log', 'a') as f:
+ f.write('\nres2:\n')
+ f.write(str(res2) + '\n')
# create multilevel dictionary
for res in res2:
@@ -1511,15 +1517,32 @@ def acc_find_possible_actions(id_role,
id_action): arglistids[a][kw] = [value]
elif not value in arglistids[a][kw]:
arglistids[a][kw] = arglistids[a][kw] + [value]
+ with open('/tmp/debug.log', 'a') as f:
+ f.write('\na:\n')
+ f.write(str(a) + '\n')
# fill list with all possible combinations
res3 = []
# rolekeys = roles2.keys(); rolekeys.sort()
+ with open('/tmp/debug.log', 'a') as f:
+ f.write('\narglistids:\n')
+ f.write(str(arglistids) + '\n')
+
for a in arglistids.keys(): # argumentlistids
# fill a list with the new entries, shortcut and copying first
# keyword list
next_arglistid = []
+ with open('/tmp/debug.log', 'a') as f:
+ f.write('\narglistids[a]:\n')
+ f.write(str(arglistids[a]) + '\n')
+ f.write('\na:\n')
+ f.write(str(a) + '\n')
+ f.write('\nkeywords[0]:\n')
+ f.write(str(keywords[0]) + '\n')
for row in arglistids[a][keywords[0]]:
+ with open('/tmp/debug.log', 'a') as f:
+ f.write('\nrow:\n')
+ f.write(str(row) + '\n')
next_arglistid.append([a, row[:] ])
# run through the rest of the keywords
for kw in keywords[1:]:
diff --git a/lib/python/invenio/dbquery.py
b/lib/python/invenio/dbquery.py index 6483592..9e7bff2 100644
--- a/lib/python/invenio/dbquery.py
+++ b/lib/python/invenio/dbquery.py
@@ -194,7 +194,7 @@ def run_sql(sql, param=None, n=0, with_desc=False,
with_dict=False, run_on_slave if run_on_slave and CFG_DATABASE_SLAVE:
dbhost = CFG_DATABASE_SLAVE
- ### log_sql_query(dbhost, sql, param) ### UNCOMMENT ONLY IF you
REALLY want to log all queries
+ log_sql_query(dbhost, sql, param) ### UNCOMMENT ONLY IF you REALLY
want to log all queries try:
db = _db_login(dbhost)
cur = db.cursor()