thank you.

in the first post is my real code.

i regard every LTMean entity as a node, and make the nodes to a map by
( k, v ) relations. by every ( k, v ) way,  i can go from one node to
another, or go back to the firest.

if use Model, it would be
=====

class LTMean( db.Model):                     #Model
    Info = db.TextProperty()
    Way = db.SelfReferenceProperty( collection_name = "Some_Set" )

def NewMean( v ):
    newMean = LTMean()
    newMean.Way = LTMean( key_name = v )
    newMean.put()
=====

but i must set variable attribute name of Way, so i need Expendo.

On 4月18日, 下午8时51分, Robert Kluin <[email protected]> wrote:
> Just a note:  'collection_name' is just a query that is put on the
> 'target' kind when the 'referencing' kind is defined.  Your definition
> of the 'referencing' kind doesn't define of those reference properties
> -- so this likely won't work as you're expecting.  Perhaps if you
> explain how exactly you're using this we could offer some alternative
> ideas.
>
> You could simply do something like this:
>
>     class LTMean( db.Expando ):
>         # your definition
>         def find_referrers(self, prop):
>             return LTMean().all().filter(prop, self)
>
> Then, instead of ltmean_entity.some_collection_name, you'll do
> ltmean_entity.find_referrers('some_thing').
>
> Robert
>
> 2011/4/18 saintthor <[email protected]>:
>
> > how add an attribute of ReferenceProperty to Expando then?
>
> > On 4月18日, 下午2时36分, "Nick Johnson (Google)" <[email protected]>
> > wrote:
> >> Hi,
>
> >> 'collection_name' is a property of the ReferenceProperty class. You can't
> >> have a collection_name if you don't have a reference property.
>
> >> -Nick Johnson
>
> >> On Mon, Apr 18, 2011 at 2:04 AM, saintthor <[email protected]> wrote:
> >> > class LTMean( db.Expando ):                     #Expando
> >> >    Info = db.TextProperty()
>
> >> > def NewMean( k, v ):
> >> >    newMean = LTMean()
> >> >    setattr( newMean, k, LTMean( key_name = v ).key() )
> >> >    newMean.put()
>
> >> > ==============
> >> > how to set the collection_name?
>
> >> > --
> >> > 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.
>
> >> --
> >> Nick Johnson, Developer Programs Engineer, App Engine
>
> > --
> > 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 
> > athttp://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 [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.

Reply via email to