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
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)
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)