DAL: parse_as_rest: solved problem when displaying tables containing more than one primary key

This commit is contained in:
Oscar Rodriguez
2014-02-18 16:27:55 +01:00
parent edbf45e542
commit 65eb1e9cb7
+5 -2
View File
@@ -8157,8 +8157,11 @@ def index():
break
otable = table
i += 1
if i==len(tags) and table:
ofields = vars.get('order',db[table]._id.name).split('|')
if i == len(tags) and table:
if hasattr(db[table], '_id'):
ofields = vars.get('order', db[table]._id.name).split('|')
else:
ofields = vars.get('order', db[table]._primarykey[0]).split('|')
try:
orderby = [db[table][f] if not f.startswith('~') else ~db[table][f[1:]] for f in ofields]
except (KeyError, AttributeError):