Hi, a question for all you datastore gurus:

If I have:

class User(db.Model):
    money = db.IntegerProperty(required=True)


class Thing(db.Model):
    cost = db.IntegerProperty(required=True)
    stuff = db.BlobProperty(required=True)


I need to allow a user to create a new thing and then reference the
things they have somehow. So a request would be called with the cost
and the blob data, and I would like to put a new Thing in the
datastore. But heres the problem, only if the user has enough money to
create the new Thing.

This is causing me a issue, as i cant update two separate entity
groups in one transaction. unless im missing something i dont want to
group them as the Thing may be sold at a later data to a new User.

so i need to:

1)get the users money
2)if they have enough create the Thing and put it in the datastore
3)update the users money and reference the Thing to the user somehow
and re-store

If any of this fails i need it all to roll back.

Currently im creating the Thing regardles and performing a transaction
on the User, if this fails i delete the Thing after. This makes me
uneasy :)

any suggestions would be most welcome.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to