Also, had to check this morning to be sure. The get_or_insert Kind is
not available via the Kind drop down in the data view, though it can
be found using gql

On Dec 21, 8:09 pm, "bowman.jos...@gmail.com"
<bowman.jos...@gmail.com> wrote:
> I'm not sure if you all changed anything, but this just worked for
> me.
>
> On Dec 18, 2:44 pm, "bowman.jos...@gmail.com"
>
> <bowman.jos...@gmail.com> wrote:
> > I've been relying on the Kind drop down. The only other difference is
> > that I'm also working within a Django structure.
>
> > I did just do the test using a GQL query, and was able to pull up the
> > original FavoriteTeamsRanking that way. Though it's still not showing
> > up in the Kind dropdown.
>
> > On Dec 18, 2:30 pm, Marzia Niccolai <ma...@google.com> wrote:
>
> > > Hi Joseph,
>
> > > I uploaded your example to an application that I own (yo.appspot.com), and
> > > it worked as expected.  So there must be something else going on here.  
> > > Have
> > > you tried to query for the model using GQL in the Admin console, or are 
> > > you
> > > just relying on the kind drop down?  I'm curious to know if this might be
> > > where the difference is.
>
> > > -Marzia
>
> > > On Thu, Dec 18, 2008 at 11:26 AM, bowman.jos...@gmail.com <
>
> > > bowman.jos...@gmail.com> wrote:
>
> > > > I'd try taking my example on as a demo application. Some differences
> > > > are
>
> > > > 1. You example below you to a put in TestModelB before the
> > > > get_or_insert. I believe in my example I found that this would work.
> > > > 2. Everything in my example is happening in one request, whereas the
> > > > shell I believe you're ending up with each put/get_or_insert happening
> > > > per request. Not sure why that would matter, but I'm not fluent in the
> > > > internals, and any testing and research I can do is on the SDK, where
> > > > everything works correctly anyhow.
>
> > > > I did do my own test using the appshell, and my results were that it
> > > > worked correctly in that instance as well.
>
> > > > >>> class JoeTest1(db.Model):
> > > >  testval = db.StringProperty()
> > > > >>> class JoeTest2(db.Model):
> > > >  testval = db.StringProperty()
> > > > >>> list(JoeTest1.all())
> > > > []
> > > > >>> list(JoeTest2.all())
> > > > []
> > > > >>> test1 = JoeTest1(testval = "test1")
> > > > >>> test1.put()
> > > > datastore_types.Key.from_path('JoeTest1', 72664L, _app=u'shell')
> > > > >>> test2 = JoeTest2.get_or_insert("x", testval = "get_or_insert test")
> > > > >>> list(JoeTest1.all())
> > > > [<__main__.JoeTest1 object at 0xdee1f6793dad2940>]
> > > > >>> list(JoeTest2.all())
> > > > [<__main__.JoeTest2 object at 0xb82607baa49b66c0>]
> > > > >>> JoeTest1.all().get().key().name()
> > > > >>> JoeTest2.all().get().key().name()
> > > > u'x'
>
> > > > On Dec 18, 1:30 pm, ryan 
> > > > <ryanb+appeng...@google.com<ryanb%2bappeng...@google.com>>
> > > > 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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to