コード例 #1
0
ファイル: utils.py プロジェクト: JordanReiter/django-domains
def get_template_name(template_dir, template_name):
    """
    Generates parts of template name
    """
    custom_function = getattr(settings, 'DOMAINS_TEMPLATE_NAME_FUNCTION', None)

    if custom_function is not None:
        return import_by_path(custom_function)(template_dir, template_name)
    hostname = get_hostname()
    return template_dir, hostname, template_name if hostname else None
コード例 #2
0
def get_template_name(template_dir, template_name):
    """
    Generates parts of template name
    """
    custom_function = getattr(settings, 'DOMAINS_TEMPLATE_NAME_FUNCTION', None)

    if custom_function is not None:
        return import_by_path(custom_function)(template_dir, template_name)
    hostname = get_hostname()
    return template_dir, hostname, template_name if hostname else None
コード例 #3
0
def setup_hook(hook):
    from domains.hooks.base import HookBase

    hook_cls = import_by_path(hook)
    hook_instance = hook_cls()

    if not isinstance(hook_instance, HookBase):
        raise ImproperlyConfigured('%s is not a HookBase instance' % hook)

    installed_hooks[hook_instance.attribute] = hook_instance
    setattr(settings, hook_instance.attribute, hook_instance)
コード例 #4
0
ファイル: utils.py プロジェクト: JordanReiter/django-domains
def setup_hook(hook):
    from domains.hooks.base import HookBase

    hook_cls = import_by_path(hook)
    hook_instance = hook_cls()

    if not isinstance(hook_instance, HookBase):
        raise ImproperlyConfigured(
            '%s is not a HookBase instance' % hook
        )

    installed_hooks[hook_instance.attribute] = hook_instance
    setattr(settings, hook_instance.attribute, hook_instance)