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

Method valid

apps/system_manage/serializers/valid_serializers.py:43–56  ·  view source on GitHub ↗
(self, is_valid=True)

Source from the content-addressed store, hash-verified

41 valid_count = serializers.IntegerField(required=True, label=_('check quantity'))
42
43 def valid(self, is_valid=True):
44 if is_valid:
45 self.is_valid(raise_exception=True)
46 model_value = model_message_dict.get(self.data.get('valid_type'))
47 license_is_valid = cache.get(Cache_Version.SYSTEM.get_key(key='license_is_valid'),
48 version=Cache_Version.SYSTEM.get_version())
49 is_license_valid = license_is_valid if license_is_valid is not None else False
50 if not is_license_valid:
51 if self.data.get('valid_count') != model_value.get('count'):
52 raise AppApiException(400, model_value.get('message'))
53 if QuerySet(
54 model_value.get('model')).count() >= model_value.get('count'):
55 raise AppApiException(400, model_value.get('message'))
56 return True

Callers 1

getMethod · 0.80

Calls 5

AppApiExceptionClass · 0.90
get_keyMethod · 0.80
get_versionMethod · 0.80
is_validMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected