Skip to content

Commit

Permalink
Fix HistoryAudit model
Browse files Browse the repository at this point in the history
It is not a child of RepresentById becuase it does not and should not have an id attr.

Duplicating the __repr__ definition in the HistoryAudit class is a
temporary fix: a proper fix requires changing all models (id and
__repr__ should be split into 2 mixins): to be done in a follow-up PR.
  • Loading branch information
jdavcs committed Jan 19, 2024
1 parent 55c0382 commit 08fcb78
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2921,7 +2921,8 @@ def is_hda(d):
return isinstance(d, HistoryDatasetAssociation)


class HistoryAudit(Base, RepresentById):
#class HistoryAudit(Base, RepresentById):
class HistoryAudit(Base):
__tablename__ = "history_audit"
__table_args__ = (PrimaryKeyConstraint(sqlite_on_conflict="IGNORE"),)

Expand All @@ -2932,6 +2933,14 @@ class HistoryAudit(Base, RepresentById):
# See https://github.com/galaxyproject/galaxy/pull/11914 for details.
__init__ = None # type: ignore[assignment]

def __repr__(self):
try:
r = f"<galaxy.model.{self.__class__.__name__}({cached_id(self)}) at {hex(id(self))}>"
except Exception:
r = object.__repr__(self)
log.exception("Caught exception attempting to generate repr for: %s", r)
return r

@classmethod
def prune(cls, sa_session):
latest_subq = (
Expand Down

0 comments on commit 08fcb78

Please sign in to comment.