perf: 修复资产类型的 bug

pull/11960/head
ibuler 2023-10-24 16:17:38 +08:00 committed by 老广
parent 1239082649
commit c1185e989a
1 changed files with 3 additions and 3 deletions

View File

@ -64,14 +64,14 @@ class BaseType(TextChoices):
@classmethod @classmethod
def _parse_protocols(cls, protocol, tp): def _parse_protocols(cls, protocol, tp):
from .protocol import Protocol from .protocol import Protocol
settings = Protocol.settings() _settings = Protocol.settings()
choices = protocol.get('choices', []) choices = protocol.get('choices', [])
if choices == '__self__': if choices == '__self__':
choices = [tp] choices = [tp]
protocols = [] protocols = []
for name in choices: for name in choices:
protocol = {'name': name, **settings.get(name, {})} protocol = {'name': name, **_settings.get(name, {})}
setting = protocol.pop('setting', {}) setting = protocol.pop('setting', {})
setting_values = {k: v.get('default', None) for k, v in setting.items()} setting_values = {k: v.get('default', None) for k, v in setting.items()}
protocol['setting'] = setting_values protocol['setting'] = setting_values
@ -112,7 +112,7 @@ class BaseType(TextChoices):
@classmethod @classmethod
def get_choices(cls): def get_choices(cls):
if not settings.XPACK_LICENSE_IS_VALID: if not settings.XPACK_ENABLED:
return [ return [
(tp.value, tp.label) (tp.value, tp.label)
for tp in cls.get_community_types() for tp in cls.get_community_types()