Skip to content

Commit

Permalink
Grumble: minor change to encoder name (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
signebedi committed Mar 27, 2024
1 parent 4db1b57 commit b65ef04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libreforms_fastapi/utils/custom_tinydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


class DateEncoder(JSONEncoder):
class CustomEncoder(JSONEncoder):
"""We need to convert date objects to 'YYYY-MM-DD' format"""
def default(self, obj):
if isinstance(obj, date):
Expand Down
4 changes: 2 additions & 2 deletions libreforms_fastapi/utils/document_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from libreforms_fastapi.utils.certificates import sign_record, verify_record_signature

from libreforms_fastapi.utils.custom_tinydb import (
DateEncoder,
CustomEncoder,
CustomTinyDB,
)

Expand Down Expand Up @@ -251,7 +251,7 @@ def _initialize_database_collections(self):
self.databases = {}
for form_name in self.form_names_callable():
# self.databases[form_name] = TinyDB(self._get_db_path(form_name))
self.databases[form_name] = CustomTinyDB(self._get_db_path(form_name), cls=DateEncoder)
self.databases[form_name] = CustomTinyDB(self._get_db_path(form_name), cls=CustomEncoder)

def _get_db_path(self, form_name:str):
"""Constructs a file path for the given form's database."""
Expand Down

0 comments on commit b65ef04

Please sign in to comment.