Reputation: 3936
>> db.Key.from_path(kind='Entity', id_or_name='name')
# Error 'Excess keyword arguments ' + repr(kwds))
>> db.Key.from_path('Entity', 'name')
# Works okay
Was the google.appengine.ext.db.Key.from_path() designed like that for a specific reason?
Upvotes: 0
Views: 222
Reputation: 85603
Because positional arguments can not be passed as keyword (default) argumentss.
This is not a problem of gae but the way python function arguments work.
From appeng docs:
Key.from_path(kind, id_or_name, parent=none, namespace=None, **kwds)
where:
**kwds
Keyword arguments. The method supports one keyword argument, parent,
which specifies a parent entity to prepend to the given path.
Its value is the parent's Key.
So "kind", "id_or_name" are not keywords but names to indicate positional arguments.
Upvotes: 2