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
.find() function does not work after a single use #34
Labels
Comments
avi-perl
changed the title
.filter() function does not work after a single use
.find() function does not work after a single use
Aug 15, 2021
Line 215 of db.py, the first instance of def find(self, pk :int, objectify: bool = False) -> getType:
with self.lock:
try:
with open(self.filename, "r", encoding="utf8") as db_file:
db_data = self._get_load_function()(db_file)
for d in db_data["data"]:
if(d[self.id_fieldname])==self._cast_id(pk):
return (
d
if not objectify
else self._objectify(json.dumps({"data": d})).data
)
else:
raise IdNotFoundError(pk)
except:
raise IdNotFoundError(pk) |
Hi @avi-perl . Will get back to this issue , sort of busy now 😅 |
fredysomy
added
hacktoberfest
bug
Something isn't working
good first issue
Good for newcomers
labels
Sep 29, 2021
Hi, is the issue still open? I can try to work on it! |
Yes , this issue is still open and you can work on it, shall I assign it to you? |
That would be great, thanks! |
Sure. Thanks , 🎉🎉 |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When writing data to the JSON db, after the first write to the file, the
.find()
method will return the record based on the ID. After adding a 2nd record and trying again, theIdNotFoundError
error is thrown despite the record being in the DB!How to reproduce
python 3.9.6
Expected behavior
The record should be returning as expected.
This is a neat library, great work!
The text was updated successfully, but these errors were encountered: