Skip to content

Commit

Permalink
Change naming for json data functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Nov 14, 2024
1 parent 3176463 commit 91a242d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gramps/gen/db/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,13 +623,13 @@ def _initialize(self, directory, username, password):
"""
raise NotImplementedError

def upgrade_table_for_json_access(self, table_name):
def upgrade_table_for_json_data(self, table_name):
"""
Overload this method to add JSON access
"""
raise NotImplementedError

def supports_json_access(self):
def use_json_data(self):
"""
Overload this method to check if the database stores objects in JSON format
"""
Expand Down Expand Up @@ -688,7 +688,7 @@ def load(
self._create_schema()
need_to_set_version = True

if self.supports_json_access():
if self.use_json_data():
self.set_serializer("json")
else:
self.set_serializer("blob")
Expand Down
4 changes: 2 additions & 2 deletions gramps/gen/db/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def gramps_upgrade_21(self):
self.set_total(length)

# First, do metadata:
self.upgrade_table_for_json_access("metadata")
self.upgrade_table_for_json_data("metadata")
keys = self._get_metadata_keys()
for key in keys:
self.set_serializer("blob")
Expand All @@ -85,7 +85,7 @@ def gramps_upgrade_21(self):
self._txn_begin()
for table_name in self._get_table_func():
# For each table, alter the database in an appropriate way:
self.upgrade_table_for_json_access(table_name.lower())
self.upgrade_table_for_json_data(table_name.lower())

get_obj_from_handle = self._get_table_func(table_name, "handle_func")
get_handles = self._get_table_func(table_name, "handles_func")
Expand Down
4 changes: 2 additions & 2 deletions gramps/plugins/db/dbapi/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class DBAPI(DbGeneric):
def _initialize(self, directory, username, password):
raise NotImplementedError

def supports_json_access(self):
def use_json_data(self):
"""
A DBAPI level method for testing if the
database supports JSON access.
Expand All @@ -91,7 +91,7 @@ def supports_json_access(self):
# if the database has been converted to use JSON data
return self.dbapi.column_exists("metadata", "json_data")

def upgrade_table_for_json_access(self, table_name):
def upgrade_table_for_json_data(self, table_name):
"""
A DBAPI level method for upgrading the given table
adding a json_data column.
Expand Down

0 comments on commit 91a242d

Please sign in to comment.