[google-appengine] Re: Python GAE version of Rails' validates_uniqueness_of

2009-08-17 Thread Daniel Rhoden
Thanks Nick. Always appreciate the help! Regarding the prefix you put in the key_name, on hunch it looks to have other benefits. I suspect memcache. Do you have any other pearls you can toss out about it, and ways that known key_name prefixes can be leveraged? --Daniel Rhoden On Aug 17

[google-appengine] Re: Python GAE version of Rails' validates_uniqueness_of

2009-08-17 Thread Nick Johnson (Google)
Hi Daniel, The best way to ensure uniqueness is to use key names. In this case, the natural key name is the User's ID. For example: user_account = Account(key_name = 'user:%d' % (current_user.user_id(),), ...) This also allows you to look up user accounts without a query: user_account = Account.