rename-stream: support non-ASCII stream names.

(imported from commit 5fe2c803c0645bb6367f39bfe58acc478a66a0eb)
This commit is contained in:
Jessica McKellar 2013-08-22 17:29:29 -04:00
parent 9ffc292a57
commit 95c70967d2

View File

@ -5,6 +5,8 @@ from django.core.management.base import BaseCommand
from zerver.lib.actions import do_rename_stream
from zerver.models import Realm, get_realm
import sys
class Command(BaseCommand):
help = """Change the stream name for a realm.
@ -16,6 +18,7 @@ Usage: python manage.py rename-stream <domain> <old name> <new name>"""
exit(1)
domain, old_name, new_name = args
encoding = sys.getfilesystemencoding()
try:
realm = get_realm(domain)
@ -23,4 +26,5 @@ Usage: python manage.py rename-stream <domain> <old name> <new name>"""
print "Unknown domain %s" % (domain,)
exit(1)
do_rename_stream(realm, old_name, new_name)
do_rename_stream(realm, old_name.decode(encoding),
new_name.decode(encoding))