Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Jan 26, 2016 · 2 comments
Closed

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

GoogleCodeExporter opened this issue Jan 26, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision fc6d68f28ea4.

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

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant