@@ -0,0 +1,489 @@
+#!/usr/bin/python%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom zerver.lib.utils import generate_random_token%0Afrom zerver.models import Stream%0A%0Aclass Command(BaseCommand):%0A    help = %22%22%22Set a token for all streams that don't have one.%22%22%22%0A%0A    def handle(self, **options):%0A        streams_needing_tokens = Stream.objects.filter(email_token=None)%0A        for stream in streams_needing_tokens:%0A            stream.email_token = generate_random_token(32)%0A            stream.save()%0A

Add a management command to generate hashes for all streams that need them.