mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
Rename create-stream to create_stream to match other management commands.
(imported from commit 28daad12943ab5eb245d7737934b08f5b29e8f90)
This commit is contained in:
32
zerver/management/commands/create_stream.py
Normal file
32
zerver/management/commands/create_stream.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from zerver.lib.actions import do_create_stream
|
||||
from zerver.models import Realm, get_realm
|
||||
|
||||
import sys
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = """Create a stream, and subscribe all active users (excluding bots).
|
||||
|
||||
This should be used for TESTING only, unless you understand the limitations of
|
||||
the command.
|
||||
|
||||
Usage: python manage.py create_stream <domain> <stream name>"""
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if len(args) != 2:
|
||||
print "Please provide a domain and the stream name."
|
||||
exit(1)
|
||||
|
||||
domain, stream_name = args
|
||||
encoding = sys.getfilesystemencoding()
|
||||
|
||||
try:
|
||||
realm = get_realm(domain)
|
||||
except Realm.DoesNotExist:
|
||||
print "Unknown domain %s" % (domain,)
|
||||
exit(1)
|
||||
|
||||
do_create_stream(realm, stream_name.decode(encoding))
|
||||
Reference in New Issue
Block a user