SelfReferenceProperty should just return a db.Key.  So assuming the property is 
set, normal Key methods should work. 

I have two suggestions:
1) Unless you are intending to dereference (ie perform another db.get()) those 
entities, use the get_value_for_datastore method.
http://code.google.com/appengine/docs/python/datastore/propertyclass.html#Property_get_value_for_datastore

And,
2)  Avoid using Parent as a property name, parent is reserved. That is just 
asking for bugs caused due to a easy to make typo. 
http://code.google.com/appengine/docs/python/datastore/modelclass.html#Disallowed_Property_Names


Robert



On Jul 13, 2010, at 12:14, saintthor <saintt...@gmail.com> wrote:

> class x( db.Model ):
>    yy = db.ReferenceProperty( y )
>    Parent = db.SelfReferenceProperty()
> 
> use yy.key().id() is ok, but Parent.key().id() is invalid. tell me
> SelfReferenceProperty have no attribute Key.
> 
> how to get the key id then?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to