MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / is_valid

Method is_valid

apps/knowledge/serializers/problem.py:200–207  ·  view source on GitHub ↗
(self, *, raise_exception=False)

Source from the content-addressed store, hash-verified

198 knowledge_id = serializers.UUIDField(required=True, label=_('knowledge id'))
199
200 def is_valid(self, *, raise_exception=False):
201 super().is_valid(raise_exception=True)
202 workspace_id = self.data.get('workspace_id')
203 query_set = QuerySet(Knowledge).filter(id=self.data.get('knowledge_id'))
204 if workspace_id:
205 query_set = query_set.filter(workspace_id=workspace_id)
206 if not query_set.exists():
207 raise AppApiException(500, _('Knowledge id does not exist'))
208
209 def batch(self, problem_list, with_valid=True):
210 if with_valid:

Callers 1

batchMethod · 0.95

Calls 3

AppApiExceptionClass · 0.90
is_validMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected