From fcd9e0d5c684ae7de2ee6f3925630cc8b67a461d Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sun, 1 Dec 2013 23:36:25 +0200 Subject: [PATCH] Fix references with GAE in NDB mode For reference types the IntegerProperty class (no matter if NDB or not) constructor is passed the referenced table name as the first parameter. For non-NDB, the first parameter is 'verbose_name'. For NDB, the first parameter is 'name'. In NDB mode this causes the property to have a wrong identity and therefore references fail to work properly. The verbose_name set in non-NDB mode is relatively harmless in comparison, but seems to be wrong as well as it does not really make sense. Do not pass referenced table name to the IntegerProperty constructor in either case. --- gluon/dal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index 8dc63f7f..58988d97 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -4839,12 +4839,10 @@ class GoogleDatastoreAdapter(NoSQLAdapter): elif field_type.startswith('reference'): if field.notnull: attr = dict(required=True) - referenced = field_type[10:].strip() - ftype = self.types[field_type[:9]](referenced, **attr) + ftype = self.types[field_type[:9]](**attr) elif field_type.startswith('list:reference'): if field.notnull: attr['required'] = True - referenced = field_type[15:].strip() ftype = self.types[field_type[:14]](**attr) elif field_type.startswith('list:'): ftype = self.types[field_type](**attr)