Reputation: 5084
I'm experiencing a critical problem with my App Engine datastore, and it seems to be completely immune to debugging: I'm unable to modify entities after constructing them.
The problem is even present when working from a console defined in app.yaml that does not share any code with my main application. Here's an example from the console:
>>> foo = Topic(name='bar') >>> foo.name 'bar' >>> foo.name = 'foo' >>> foo.name 'bar'
This same behavior affects all entity kinds and all properties in the application. Whether the entity has been saved makes no difference.
I've tried going back to revs from days, weeks, and months ago, and the problem is still present, even though I would have definitely noticed it if it was actually around weeks and months ago, since it breaks the app logic. It is present on different machines running both Ubuntu and OSX, and it is also present on all app versions on production, and it is present on at least one other application I've tested. It's still present after wiping my SDK datastore, using a different port, flushing my memcache and taskqueue, reinstalling the SDK, and every other debugging trick I can think of in my desperation.
The one place that isn't affected is the administration console. The same sequence of code gets the expected result of a modified entity. Even after I import every module or class I can think of that might be causing trouble, the console still always works as expected. Another indication that there's nothing in my code that's causing this problem (and that I'm not going completely insane).
I'm fairly certain that as of a couple days ago, I could modify entities from within my app just as I can from the administration console. After all, immutable entities aren't very useful.
Some advice would be really, really appreciated. I'm afraid that this problem will prevent me from continuing development until I can get it fixed.
Upvotes: 0
Views: 246
Reputation: 476
What kind of console are you using? If it's derived from shell.appspot.com or similar, it is most likely that the console's saving and restoring globals at each >>>
prompt is causing these pains.
If you use the interactive console at /_ah/admin/interactive
(on by default in dev_appserver.py) please try putting all related code in the input window and executing it in one fell swoop; this will prevent any save/restore behavior from getting in the way of your experiments.
Upvotes: 1
Reputation: 101149
It's probably a stupid question, but are you calling .put() after modifying your entities? I can't really tell from your code example if your subsequent fetch of the property after setting it is supposed to be in the same session, or another one.
Also, can you please paste the relevant Model definition? And tell us if you're using any App-Engine specific libraries that may be interfering with your models.
Upvotes: 0