making uniqueconstraint error easier to read

This commit is contained in:
evilchili 2025-10-03 16:38:14 -07:00
parent f1a47aaed4
commit 1fe0d7bbdf
2 changed files with 3 additions and 5 deletions

View File

@ -52,8 +52,8 @@ class RecordTable(table.Table):
def _check_unique(self, document) -> bool: def _check_unique(self, document) -> bool:
matches = [ matches = [
match dict(match)
for match in self.search( for match in super().search(
reduce( reduce(
ior, ior,
[ [

View File

@ -140,7 +140,7 @@ class Pointer(Field):
def reference(cls, value: Record | str): def reference(cls, value: Record | str):
# XXX This could be smarter # XXX This could be smarter
if isinstance(value, str): if isinstance(value, str):
if '::' not in value: if "::" not in value:
raise PointerReferenceError("Value {value} does not look like a reference!") raise PointerReferenceError("Value {value} does not look like a reference!")
return value return value
if value: if value:
@ -203,5 +203,3 @@ class Collection(Field):
for backref in target._metadata.backrefs(type(record)): for backref in target._metadata.backrefs(type(record)):
target[backref.name] = record target[backref.name] = record
db.save(target) db.save(target)