settings: Extract settings.ZILENCER_ENABLED.

This commit is contained in:
Tim Abbott
2016-07-18 21:38:23 -07:00
parent 0aaa55fb8f
commit 1f4c9eefe4
4 changed files with 7 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ from six import text_type
from typing import Union, Any, Callable, Sequence, Dict, Optional
from zerver.lib.str_utils import force_bytes
if settings.ZULIP_COM:
if settings.ZILENCER_ENABLED:
from zilencer.models import get_deployment_by_domain, Deployment
else:
from mock import Mock

View File

@@ -9,7 +9,7 @@ from django.core.management.base import BaseCommand
from zerver.lib.actions import do_create_realm, set_default_streams
from zerver.models import RealmAlias
if not settings.VOYAGER:
if settings.ZILENCER_ENABLED:
from zilencer.models import Deployment
import re
@@ -69,7 +69,7 @@ Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
print("\033[1;31mExternal deployments cannot be open realms.\033[0m\n", file=sys.stderr)
self.print_help("python manage.py", "create_realm")
exit(1)
if options["deployment_id"] is not None and settings.VOYAGER:
if options["deployment_id"] is not None and not settings.ZILENCER_ENABLED:
print("\033[1;31mExternal deployments are not supported on voyager deployments.\033[0m\n", file=sys.stderr)
exit(1)
@@ -87,7 +87,7 @@ Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
deployment.realms.add(realm)
deployment.save()
print("Added to deployment", str(deployment.id))
elif settings.ZULIP_COM:
elif settings.PRODUCTION and settings.ZILENCER_ENABLED:
deployment = Deployment.objects.get(base_site_url="https://zulip.com/")
deployment.realms.add(realm)
deployment.save()

View File

@@ -59,7 +59,7 @@ def queue_digest_recipient(user_profile, cutoff):
def domains_for_this_deployment():
# type: () -> List[str]
if settings.ZULIP_COM:
if settings.ZILENCER_ENABLED:
# Voyager deployments don't have a Deployment entry.
# Only send zulip.com digests on staging.
from zilencer.models import Deployment

View File

@@ -313,6 +313,8 @@ INSTALLED_APPS = [
'zerver',
] + EXTRA_INSTALLED_APPS
ZILENCER_ENABLED = 'zilencer' in INSTALLED_APPS
# Base URL of the Tornado server
# We set it to None when running backend tests or populate_db.
# We override the port number when running frontend tests.