OK, I found it. For each property, GAE (at least the SDK version of
it) creates an underscored attribute to keep the value of the
property. For example, if you have:
my_prop = StringProperty()
GAE will create an attribute called "_my_prop".
In case of the property called "entity", created attribute conflicts
with the attribute "_entity" that is used by GAE to keep an instance
of the datastore.Entity class.
I think the documentation should be updated to reflect this. Other
used attributes, such as "_parent", "_key_name" and "_app" are
documented; as far as I can see "_entity" is the only one missed:
http://code.google.com/appengine/docs/datastore/modelclass.html#Disallowed_Property_Names
The bottom line: don't use "entity" as a property name :)
On Aug 28, 4:31 pm, Alexander Kojevnikov <[EMAIL PROTECTED]>
wrote:
> I guess it's one of reserved attribute names, even though it's not
> documented:http://code.google.com/appengine/docs/datastore/modelclass.html#Disal...
>
> On Aug 22, 4:14 am, "David I. Murray" <[EMAIL PROTECTED]> wrote:
>
> > if I have a ReferenceProperty named "entity" and try to do db accesses
> > of this field, you receive an exception with the following error
> > message:
>
> > "Key" object does not support item assignment
>
> > If I change "entity" to any other name (and change nothing else about
> > my code), things suddenly work. Interesting, eh? I'd encourage you to
> > try it out in case I'm smoking crack. But I changed nothing else about
> > my code, any verified it wasn't a caching issue or anything like that.
>
> > Anyone else able to repro this?
>
> > Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---