django-orchestra/orchestra/contrib/saas/services/dokuwiki.py

25 lines
853 B
Python
Raw Permalink Normal View History

from urllib.parse import urlparse
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
2015-03-23 15:36:51 +00:00
from .options import SoftwareService
2015-09-29 12:35:22 +00:00
from .. import settings
2015-03-23 15:36:51 +00:00
class DokuWikiService(SoftwareService):
2015-06-09 11:16:36 +00:00
name = 'dokuwiki'
2015-03-23 15:36:51 +00:00
verbose_name = "Dowkuwiki"
icon = 'orchestra/icons/apps/Dokuwiki.png'
2015-09-29 12:35:22 +00:00
site_domain = settings.SAAS_DOKUWIKI_DOMAIN
allow_custom_url = settings.SAAS_DOKUWIKI_ALLOW_CUSTOM_URL
def clean(self):
if self.allow_custom_url and self.instance.custom_url:
url = urlparse(self.instance.custom_url)
if url.path and url.path != '/':
raise ValidationError({
'custom_url': _("Support for specific URL paths (%s) is not implemented.") % url.path
})
super(DokuWikiService, self).clean()