[google-appengine] Re: Disappearing reference collections

2009-02-01 Thread James

It appears as if this is occurring when I'm not importing the Comment
model. This might be mentioned in the docs, but I've been developing
with GAE for a while and didn't know that it was necessary to import
the model of the referred entity kind.

On Feb 1, 2:23 am, James  wrote:
> Let's use a simple example of a model containing posts and comments.
> The comment model contains a ReferenceProperty to Post, with a
> "comments" collection name.
>
> It always works fine locally:
>
> # Let's build a query object:
> from model import Post
> p = Post.all().get()
> p.comments>> 
>
> # Now we can fetch a list of comment entities.
>
> Sometimes, it works correctly on production. But sometimes, this
> happens:
>
> # Let's build a query object:
> from model import Post
> p = Post.all().get()
> p.comments
>
> >> AttributeError: 'Post' object has no attribute 'comments'
>
> And this is for entities where I've double and triple checked the
> model and the existence of the reference data. This problem didn't
> exist for me unitl a few days ago, either.
>
> I suspect this could be an index.yaml issue, but I use the -
> require_indexes dev_appserver param, and I've double-checked my index.
>
> Please, please do suggest something if you know the answer. This is a
> nasty bug, and I have no idea where it's coming from.
--~--~-~--~~~---~--~~
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-appengine@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
-~--~~~~--~~--~--~---



[google-appengine] Re: Disappearing reference collections

2009-02-01 Thread Alexander Kojevnikov

On Feb 2, 12:15 pm, James  wrote:
> It appears as if this is occurring when I'm not importing the Comment
> model. This might be mentioned in the docs, but I've been developing
> with GAE for a while and didn't know that it was necessary to import
> the model of the referred entity kind.
>
The Comment class actually creates the Post.comments attribute behind
the scenes. Check the ReferenceProperty.__property_config__() method
for implementation details.

I agree however that this fact should have been documented.
--~--~-~--~~~---~--~~
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-appengine@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
-~--~~~~--~~--~--~---



[google-appengine] Re: Disappearing reference collections

2009-02-01 Thread James

Thanks for the tip.

 I've been meaning for some relevant opportunities to look more into
the internals.


On Feb 1, 6:17 pm, Alexander Kojevnikov 
wrote:
> On Feb 2, 12:15 pm, James  wrote:> It appears as if 
> this is occurring when I'm not importing the Comment
> > model. This might be mentioned in the docs, but I've been developing
> > with GAE for a while and didn't know that it was necessary to import
> > the model of the referred entity kind.
>
> The Comment class actually creates the Post.comments attribute behind
> the scenes. Check the ReferenceProperty.__property_config__() method
> for implementation details.
>
> I agree however that this fact should have been documented.
--~--~-~--~~~---~--~~
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-appengine@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
-~--~~~~--~~--~--~---