Ah ha, Ryan, try this (unless I made a typo somewhere, for some reason
Chrome and that textbox don't like each other and I was too lazy to
change browsers). Note how I do the testa.put() and then the
JoeTestB.get_or_insert all in the same box, then I when I go to check
JoeTestB I can't. It looks like it really is the puts and
get_or_inserts all in the same execution string.
>>> class JoeTestA(db.Model):
testval = db.StringProperty()
>>> class JoeTestB(db.Model):
testval = db.StringProperty()
>>> testa = JoeTestA(testval = "test A")
testa.put()
testb = JoeTestB.get_or_insert("x", "test B")
>>> JoeTestB.all().get().key().name()
Traceback (most recent call last):
File "/base/data/home/apps/shell/1.30/shell.py", line 266, in get
exec compiled in statement_module.__dict__
File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'key'
On Dec 18, 1:30 pm, ryan <[email protected]> wrote:
> true. i was cheating because i know the datastore internals, so i know
> what's relevant to problems like these and what isn't. Model vs.
> Expando, for example, generally isn't relevant.
>
> still, following your code much more closely,http://shell.appspot.com/
> still doesn't reproduce this. odd.
>
> >>> class TestModelA(db.Model):
>
> testval = db.StringProperty()>>> class TestModelB(db.Model):
>
> testval = db.StringProperty()>>> list(TestModelA.all())
> []
> >>> list(TestModelB.all())
> []
> >>> test1 = TestModelA(testval = "Test put 1")
> >>> test1.put()
>
> datastore_types.Key.from_path('TestModelA', 72663L, _app=u'shell')>>> test2 =
> TestModelB(testval = "Test put 2")
> >>> test2.put()
>
> datastore_types.Key.from_path('TestModelB', 73462L, _app=u'shell')>>>
> TestModelA().get_or_insert("goi_test", testval="get_or_insert test")
>
> <__main__.TestModelA object at 0x4a9988195796e710>>>>
> TestModelB().get_or_insert("goi_test2", testval="get_or_insert test 2")
>
> <__main__.TestModelB object at 0x386035de932ed718>>>> list(TestModelA.all())
>
> [<__main__.TestModelA object at 0xbad1185da0f83490>,
> <__main__.TestModelA object at 0xbad1185da0f83550>]>>> list(TestModelB.all())
>
> [<__main__.TestModelB object at 0x4a9988195796e3d0>,
> <__main__.TestModelB object at 0x4a9988195796e290>]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---