It looks like you are trying to make a the parent of b.  You are
doing it like this:

    B(a=a)

  I think you meant:

    B(parent=a)


  P.S.  Unrelated, I would like to point out that by calling A.get
outside of the transaction function you could end up losing
transactional integrity.  The values for a.up and a.down could change
in the datastore between A.get and the transaction function.


On Oct 24, 4:16 am, log1 <[email protected]> wrote:
> Hello,
>
> This is my problem:
>
> class A(db.Model):
>   up = db.IntegerProperty(default=0, required=True)
>   down = db.IntegerProperty(default=0, required=True)
>
>   def move(self, direction):
>     a = A.get(self.key())
>
>     def txn(a, direction):
>       if direction == "up":
>         a.up  += 1
>       else:
>         a.down += 1
>       a.put() # OK
>       b = B(a=a)
>       b.put() # Cannot operate on different entity groups in a
> transaction???
>
>     db.run_in_transaction(txn, a, direction)
>
> class B(db.Model):
>   a =  db.ReferenceProperty(A, collection_name='a_b')
>
> Can somebody tell me what I'm doing wrong?
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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