moo.sdk.objects.lookup
- moo.sdk.objects.lookup(x, return_first=True)
Lookup an object within the current site by PK, name, or alias.
PK lookups are site-scoped: an integer PK that belongs to a different universe raises
NoSuchObjectErrorthe same as a missing object would. Internal system code that genuinely needs cross-site access should useObject.global_objectsdirectly rather than going through this function.- Parameters:
x (
Union[int,str]) – lookup valuereturn_first (
bool) – when True (default), return the first match or raise NoSuchObjectError; when False, return a list of all matches (may be empty)
- Returns:
the result of the lookup, or a list when return_first is False
- Return type:
- Raises:
NoSuchObjectError – when a result cannot be found and return_first is True