Hi

You need to make sure the class at the other end of the reference is
imported other wise
you will get exactly this.

I would suggest you have a couple of paths through your code and one
end of the reference set is not being imported.

class A
    b = refpropery(B)

class B
    blah


If you do  B.a_set, 'A' must be imported, otherwise you get
AttributeError: B' object has no attribute 'a_set'

Hope that make sense.

T

On Sep 4, 3:34 am, peterk <[email protected]> wrote:
> Hi Joseph,
>
> This is all on the production environment.
>
> I make some entities with references, the call to model_set works.
>
> I call appcfg.py (with no changes) and suddenly it doesn't. I get the
> error that the entity no longer has that model_set attribute.
>
> I will see if changing search.SearchableModel back to plain old
> db.Model fixes it...
>
> Thanks,
>
> On Sep 3, 7:36 pm, Joseph Letness <[email protected]> wrote:
>
>
>
>
>
>
>
> > Are you saying that it works on your development server but fails on
> > your production app, or that your local app begins to fail after you
> > update?
>
> > If the former, it might be an indexing problem that is not is not
> > being explicitly identified by the error message.  I've encountered a
> > similar problem in the past (I've never used search.SearchableModel,
> > but it sounds like something that might rely on a defined index which,
> > if you were using an otherwise mundane property class would work with
> > an autogenerated index).  A good way to test for this is to restart
> > your dev server with "--require_indexes" and see if you get the same
> > failure.
>
> > If your problem is that your reference suddenly begins to fail on your
> > development server then there must be something going on with your
> > update script and your local datastore.  You might try using the
> > Dataviewer in your SDK console to inspect your entities before and
> > after an update to see if you are losing data, somehow.  Perhaps
> > search.SearchableModel (again, pure speculation here) has some sort of
> > caching property that is getting cleared on update?
>
> > Good luck,
>
> > Joe
>
> > On Sep 3, 6:49 am, peterk <[email protected]> wrote:
>
> > > Hello,
>
> > > I hadn't used referenceproperty much before in my applications, but
> > > have cause to use it now, and the behaviour of it is really confusing
> > > me.
>
> > > I have an entity with a reference to a second entity.
>
> > > From the documentation I believe I should be able to say something
> > > like:
>
> > > x.entityb_set
>
> > > to retrieve all instances of model entityb that reference x.
>
> > > This works, but as soon as I do an appcfg.py update of my application,
> > > it stops working. It's like for the existing data, the application has
> > > forgotten the references. I get the error:
>
> > > AttributeError: 'ModelA' object has no attribute 'modelb_set'
>
> > > (I have replaced the model names here)
>
> > > If I delete the data in my datastore and recreate these entities, it
> > > works. Until I do another update, when again I get this error.
>
> > > Why would it behave like this? It's frustrating me no end. If it makes
> > > a difference, these models are extending from search.SearchableModel.
>
> > > Thanks for any help!

-- 
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