Skip to content

Commit eea8288

Browse files
committed
Allow refcode from other deployments to pass through the Item model
1 parent d96631a commit eea8288

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pydatalab/pydatalab/models/items.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ class Item(Entry, HasOwner, HasRevisionControl, IsCollectable, HasBlocks, abc.AB
4747

4848
@validator("refcode", pre=True, always=True)
4949
def refcode_validator(cls, v):
50-
"""Generate a refcode if not provided; check that the refcode has the correct prefix if provided."""
51-
52-
from pydatalab.config import CONFIG
53-
54-
if v and not v.startswith(f"{CONFIG.IDENTIFIER_PREFIX}:"):
55-
raise ValueError(f"refcode missing prefix {CONFIG.IDENTIFIER_PREFIX!r}")
50+
"""Generate a refcode if not provided."""
51+
52+
if v:
53+
prefix = None
54+
id = None
55+
prefix, id = v.split(":")
56+
if prefix is None or id is None:
57+
raise ValueError(f"refcode missing prefix or ID {id=}, {prefix=} from {v=}")
5658

5759
return v

0 commit comments

Comments
 (0)