From 65eb1e9cb729d42165f97c90ff0b2e3ed914d46c Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Tue, 18 Feb 2014 16:27:55 +0100 Subject: [PATCH] DAL: parse_as_rest: solved problem when displaying tables containing more than one primary key --- gluon/dal.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index 48f08c31..6f96ea20 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -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):