HypeTutorials / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

StorageByKeyName().get() has side effects #48

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you create a StorageByKeyName() and call get() on it, it will actually 
perform a get_or_insert(). This seems unintuitive, since I wouldn't expect 
calling a function called get() would (if it doesn't find the desired key) 
actually insert a record...

What steps will reproduce the problem?
1. SomeModel.get_by_key_name('NonexistentKey')
2. StorageByKeyName(SomeModel,'NonexistentKey').get()
3. SomeModel.get_by_key_name('NonexistentKey') now exists!

Perhaps I'm thinking about StorageByKeyName wrong?

Original issue reported on code.google.com by jer...@google.com on 24 Jul 2011 at 9:17

GoogleCodeExporter commented 8 years ago
Since .put() uses .get_or_insert() then it isn't necessary in .get(). Will fix.

Original comment by jcgregorio@google.com on 25 Jul 2011 at 2:35

GoogleCodeExporter commented 8 years ago
This issue was closed by revision fc6d68f28ea4.

Original comment by jcgregorio@google.com on 18 Nov 2011 at 1:19