KeyProperty and repeated=True

84 views
Skip to first unread message

Owen Nelson

unread,
Nov 13, 2011, 7:01:40 PM11/13/11
to google-a...@googlegroups.com
Hi, I'm working with the new datastore plus API, and I'm getting a stack trace when I create a model with a repeated KeyProperty. Is this expected?
The error the trace ends with is:
TypeError: argument of type 'MetaModel' is not iterable

I'm specifying the property like:

class MyModel(model.Model):
    bars = model.KeyProperty(Bar, repeated=True)

Owen Nelson

unread,
Nov 14, 2011, 4:38:59 PM11/14/11
to google-a...@googlegroups.com
Ok, I think I see where the disconnect is.
KeyProperty only accepts instances of model.Key (which is fair). If I want to limit my property on my model to only accept certain kinds of keys, I should enforce this requirement through a validator.

Unless there's a better way, I think I'm all set!

Regards,
Owen Nelson
Reply all
Reply to author
Forward
0 new messages