applications: add a feature flag for combo elements (#78738)
gitea/hobo/pipeline/head This commit looks good
Details
gitea/hobo/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8efc84a7e1
commit
7c32edf387
|
@ -42,7 +42,7 @@ requests = Requests()
|
|||
def get_object_types():
|
||||
object_types = []
|
||||
for service_id, services in getattr(settings, 'KNOWN_SERVICES', {}).items():
|
||||
if service_id not in Application.SUPPORTED_MODULES:
|
||||
if service_id not in Application.get_supported_modules():
|
||||
continue
|
||||
service_objects = {x.get_base_url_path(): x for x in get_installed_services(types=[service_id])}
|
||||
for service in services.values():
|
||||
|
@ -78,8 +78,6 @@ class UnlinkError(ApplicationError):
|
|||
|
||||
|
||||
class Application(models.Model):
|
||||
SUPPORTED_MODULES = ('wcs', 'combo')
|
||||
|
||||
name = models.CharField(max_length=100, verbose_name=_('Name'))
|
||||
slug = models.SlugField(max_length=100)
|
||||
icon = models.FileField(
|
||||
|
@ -106,6 +104,13 @@ class Application(models.Model):
|
|||
def __repr__(self):
|
||||
return '<Application %s>' % self.slug
|
||||
|
||||
@classmethod
|
||||
def get_supported_modules(cls):
|
||||
modules = ['wcs']
|
||||
if settings.HOBO_APPLICATION_COMBO_SUPPORT:
|
||||
modules.append('combo')
|
||||
return modules
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.slug:
|
||||
base_slug = slugify(self.name)[:95]
|
||||
|
@ -192,7 +197,7 @@ class Application(models.Model):
|
|||
|
||||
def unlink(self):
|
||||
for service_id, services in getattr(settings, 'KNOWN_SERVICES', {}).items():
|
||||
if service_id not in Application.SUPPORTED_MODULES:
|
||||
if service_id not in Application.get_supported_modules():
|
||||
continue
|
||||
service_objects = {x.get_base_url_path(): x for x in get_installed_services(types=[service_id])}
|
||||
for service in services.values():
|
||||
|
@ -368,7 +373,7 @@ class Version(models.Model):
|
|||
target_url = 'api/export-import/bundle-check/'
|
||||
exception_message = _('Failed to check local modifications for module %s (%s)')
|
||||
for service_id, services in getattr(settings, 'KNOWN_SERVICES', {}).items():
|
||||
if service_id not in Application.SUPPORTED_MODULES:
|
||||
if service_id not in Application.get_supported_modules():
|
||||
continue
|
||||
service_objects = {x.get_base_url_path(): x for x in get_installed_services(types=[service_id])}
|
||||
for service in services.values():
|
||||
|
@ -407,7 +412,7 @@ class Version(models.Model):
|
|||
exception_message = _('Failed to declare elements for module %s (%s)')
|
||||
|
||||
for service_id, services in getattr(settings, 'KNOWN_SERVICES', {}).items():
|
||||
if service_id not in Application.SUPPORTED_MODULES:
|
||||
if service_id not in Application.get_supported_modules():
|
||||
continue
|
||||
service_objects = {x.get_base_url_path(): x for x in get_installed_services(types=[service_id])}
|
||||
for service in services.values():
|
||||
|
|
|
@ -244,6 +244,9 @@ HOBO_SERVICES_DISABLED = [
|
|||
# List of service to show in the create service menu, it overrides HOBO_SERVICES_DISABLED.
|
||||
HOBO_SERVICES_ENABLED = []
|
||||
|
||||
# Support for combo elements in applications
|
||||
HOBO_APPLICATION_COMBO_SUPPORT = False
|
||||
|
||||
# Phone prefixes by country for phone number as authentication identifier
|
||||
PHONE_COUNTRY_CODES = {
|
||||
'32': {'region': 'BE', 'region_desc': _('Belgium')},
|
||||
|
|
Loading…
Reference in New Issue