Replace python2.7 by python everywhere.

This commit is contained in:
Eklavya Sharma
2016-04-07 18:57:25 +05:30
committed by Tim Abbott
parent 149938d468
commit 94e4b39112
24 changed files with 61 additions and 61 deletions

View File

@@ -44,7 +44,7 @@ It will correctly not count server-initiated reloads in the activity statistics.
The duration flag can be used to control how many days to show usage duration for The duration flag can be used to control how many days to show usage duration for
Usage: python2.7 manage.py analyze_user_activity [--realm=zulip.com] [--date=2013-09-10] [--duration=1] Usage: python manage.py analyze_user_activity [--realm=zulip.com] [--date=2013-09-10] [--duration=1]
By default, if no date is selected 2013-09-10 is used. If no realm is provided, information By default, if no date is selected 2013-09-10 is used. If no realm is provided, information
is shown for all realms""" is shown for all realms"""

View File

@@ -14,9 +14,9 @@ class Command(BaseCommand):
Usage examples: Usage examples:
python2.7 manage.py client_activity python manage.py client_activity
python2.7 manage.py client_activity zulip.com python manage.py client_activity zulip.com
python2.7 manage.py client_activity jesstess@zulip.com""" python manage.py client_activity jesstess@zulip.com"""
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('arg', metavar='<arg>', type=str, nargs='?', default=None, parser.add_argument('arg', metavar='<arg>', type=str, nargs='?', default=None,

View File

@@ -33,7 +33,7 @@ import stat
try: try:
from subprocess import CalledProcessError from subprocess import CalledProcessError
except ImportError: except ImportError:
# from python2.7:subprocess.py # from python:subprocess.py
# Exception classes used by this module. # Exception classes used by this module.
class CalledProcessError(Exception): class CalledProcessError(Exception):
"""This exception is raised when a process run by check_call() returns """This exception is raised when a process run by check_call() returns

View File

@@ -93,11 +93,11 @@ class IRCBot(irc.bot.SingleServerIRCBot):
return return
self.dcc_connect(address, port) self.dcc_connect(address, port)
usage = """python2.7 irc-mirror.py --server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> [optional args] usage = """python irc-mirror.py --server=IRC_SERVER --channel=<CHANNEL> --nick-prefix=<NICK> [optional args]
Example: Example:
python2.7 irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username python irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username
--site=https://zulip.example.com --user=irc-bot@example.com --site=https://zulip.example.com --user=irc-bot@example.com
--api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

View File

@@ -1,4 +1,4 @@
MAILTO=root MAILTO=root
# Send digest emails once a day. Time is in UTC. # Send digest emails once a day. Time is in UTC.
0 18 * * * zulip cd /home/zulip/deployments/current && python2.7 manage.py enqueue_digest_emails 0 18 * * * zulip cd /home/zulip/deployments/current && python manage.py enqueue_digest_emails

View File

@@ -8,7 +8,7 @@
; variables can be expanded using this syntax: "%(ENV_HOME)s". ; variables can be expanded using this syntax: "%(ENV_HOME)s".
[fcgi-program:zulip-django] [fcgi-program:zulip-django]
command=python2.7 /home/zulip/deployments/current/manage.py runfcgi daemonize=False maxchildren=20 ; the program (relative uses PATH, can take args) command=python /home/zulip/deployments/current/manage.py runfcgi daemonize=False maxchildren=20 ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s) ;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1 ; number of processes copies to start (def 1) ;numprocs=1 ; number of processes copies to start (def 1)
;directory=/tmp ; directory to cwd to before exec (def no cwd) ;directory=/tmp ; directory to cwd to before exec (def no cwd)
@@ -43,7 +43,7 @@ socket_owner=zulip:zulip
socket_mode=0700 socket_mode=0700
[program:zulip-tornado] [program:zulip-tornado]
command=python2.7 /home/zulip/deployments/current/manage.py runtornado 127.0.0.1:9993 command=python /home/zulip/deployments/current/manage.py runtornado 127.0.0.1:9993
priority=200 ; the relative start priority (default 999) priority=200 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -57,7 +57,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-user-activity] [program:zulip-events-user-activity]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=user_activity command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=user_activity
priority=300 ; the relative start priority (default 999) priority=300 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -71,7 +71,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-user-activity-interval] [program:zulip-events-user-activity-interval]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=user_activity_interval command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=user_activity_interval
priority=300 ; the relative start priority (default 999) priority=300 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -85,7 +85,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-user-presence] [program:zulip-events-user-presence]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=user_presence command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=user_presence
priority=300 ; the relative start priority (default 999) priority=300 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -99,7 +99,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-signups] [program:zulip-events-signups]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=signups command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=signups
priority=400 ; the relative start priority (default 999) priority=400 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -113,7 +113,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-confirmation-emails] [program:zulip-events-confirmation-emails]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=invites command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=invites
priority=500 ; the relative start priority (default 999) priority=500 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -127,7 +127,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-missedmessage_reminders] [program:zulip-events-missedmessage_reminders]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=missedmessage_emails command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=missedmessage_emails
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -141,7 +141,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-missedmessage_mobile_notifications] [program:zulip-events-missedmessage_mobile_notifications]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=missedmessage_mobile_notifications command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=missedmessage_mobile_notifications
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -155,7 +155,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-slowqueries] [program:zulip-events-slowqueries]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=slow_queries command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=slow_queries
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -169,7 +169,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-message_sender] [program:zulip-events-message_sender]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=message_sender --worker_num=%(process_num)s command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=message_sender --worker_num=%(process_num)s
process_name=%(program_name)s-%(process_num)s process_name=%(program_name)s-%(process_num)s
priority=350 ; the relative start priority (default 999) priority=350 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
@@ -185,7 +185,7 @@ directory=/home/zulip/deployments/current/
numprocs=5 numprocs=5
[program:zulip-events-feedback_messages] [program:zulip-events-feedback_messages]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=feedback_messages command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=feedback_messages
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -199,7 +199,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-error_reports] [program:zulip-events-error_reports]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=error_reports command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=error_reports
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -213,7 +213,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-digest_emails] [program:zulip-events-digest_emails]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=digest_emails command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=digest_emails
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -227,7 +227,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-events-email_mirror] [program:zulip-events-email_mirror]
command=python2.7 /home/zulip/deployments/current/manage.py process_queue --queue_name=email_mirror command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=email_mirror
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -241,7 +241,7 @@ stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/ directory=/home/zulip/deployments/current/
[program:zulip-deliver-enqueued-emails] [program:zulip-deliver-enqueued-emails]
command=python2.7 /home/zulip/deployments/current/manage.py deliver_email command=python /home/zulip/deployments/current/manage.py deliver_email
priority=600 ; the relative start priority (default 999) priority=600 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)

View File

@@ -1,3 +1,3 @@
MAILTO=root MAILTO=root
*/10 * * * * zulip cd /home/zulip/deployments/current && python2.7 manage.py active_user_stats */10 * * * * zulip cd /home/zulip/deployments/current && python manage.py active_user_stats

View File

@@ -1,4 +1,4 @@
MAILTO=root MAILTO=root
# Remove any stale apple device tokens from our list # Remove any stale apple device tokens from our list
0 3 * * * zulip cd /home/zulip/deployments/current && python2.7 manage.py check_apns_tokens 0 3 * * * zulip cd /home/zulip/deployments/current && python manage.py check_apns_tokens

View File

@@ -1,4 +1,4 @@
MAILTO=root MAILTO=root
# Clear all expired Django sessions at 10:22 PM every day. # Clear all expired Django sessions at 10:22 PM every day.
22 22 * * * zulip cd /home/zulip/deployments/current && python2.7 manage.py clearsessions 22 22 * * * zulip cd /home/zulip/deployments/current && python manage.py clearsessions

View File

@@ -3,7 +3,7 @@
[program:zulip-carbon-cache] [program:zulip-carbon-cache]
command=python2.7 /opt/graphite/bin/carbon-cache.py --debug start command=python /opt/graphite/bin/carbon-cache.py --debug start
priority=200 ; the relative start priority (default 999) priority=200 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)
@@ -15,7 +15,7 @@ stdout_logfile=/var/log/zulip/carbon-cache.log ; stdout log path, NONE f
directory=/home/zulip/ directory=/home/zulip/
[program:zulip-carbon-aggregator] [program:zulip-carbon-aggregator]
command=python2.7 /opt/graphite/bin/carbon-aggregator.py --debug start command=python /opt/graphite/bin/carbon-aggregator.py --debug start
priority=200 ; the relative start priority (default 999) priority=200 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true) autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected) autorestart=true ; whether/when to restart (default: unexpected)

View File

@@ -21,10 +21,10 @@ if pwd.getpwuid(os.getuid())[0] != "zulip":
sys.exit(1) sys.exit(1)
# Send a statsd event on restarting the server # Send a statsd event on restarting the server
subprocess.check_call(["python2.7", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))]) subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
logging.info("Filling memcached caches") logging.info("Filling memcached caches")
subprocess.check_call(["python2.7", "./manage.py", "fill_memcached_caches"]) subprocess.check_call(["python", "./manage.py", "fill_memcached_caches"])
# Restart the FastCGI and related processes via supervisorctl. # Restart the FastCGI and related processes via supervisorctl.
logging.info("Stopping workers") logging.info("Stopping workers")

View File

@@ -4,12 +4,12 @@ set -xe
# Change to root directory of the checkout that we're running from # Change to root directory of the checkout that we're running from
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
python2.7 manage.py checkconfig python manage.py checkconfig
python2.7 manage.py migrate --noinput python manage.py migrate --noinput
python2.7 manage.py createcachetable third_party_api_results python manage.py createcachetable third_party_api_results
if ! python2.7 manage.py initialize_voyager_db; then if ! python manage.py initialize_voyager_db; then
set +x set +x
echo echo
echo -e "\033[32mPopulating default database failed." echo -e "\033[32mPopulating default database failed."

View File

@@ -65,7 +65,7 @@ to pull out the resulting HTML :)
</div> </div>
<div class="tab-pane" id="python"> <div class="tab-pane" id="python">
<div class="codehilite"><pre><span class="c">#!/usr/bin/env python2.7</span> <div class="codehilite"><pre><span class="c">#!/usr/bin/env python</span>
<span class="kn">import</span> <span class="nn">zulip</span> <span class="kn">import</span> <span class="nn">zulip</span>
<span class="kn">import</span> <span class="nn">sys</span> <span class="kn">import</span> <span class="nn">sys</span>

View File

@@ -75,7 +75,7 @@ def run_test(test):
print("Actual test to be run is %s, but import failed." % (actual_test_name,)) print("Actual test to be run is %s, but import failed." % (actual_test_name,))
print("Importing test module directly to generate clearer traceback:") print("Importing test module directly to generate clearer traceback:")
try: try:
command = ["python2.7", "-c", "import %s" % (actual_test_name,)] command = ["python", "-c", "import %s" % (actual_test_name,)]
print("Import test command: `%s`" % (' '.join(command),)) print("Import test command: `%s`" % (' '.join(command),))
subprocess.check_call(command) subprocess.check_call(command)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:

View File

@@ -16,7 +16,7 @@ import sys
class Command(BaseCommand): class Command(BaseCommand):
help = """Create a realm for the specified domain. help = """Create a realm for the specified domain.
Usage: python2.7 manage.py create_realm --domain=foo.com --name='Foo, Inc.'""" Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
option_list = BaseCommand.option_list + ( option_list = BaseCommand.option_list + (
make_option('-o', '--open-realm', make_option('-o', '--open-realm',
@@ -58,12 +58,12 @@ Usage: python2.7 manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
def handle(self, *args, **options): def handle(self, *args, **options):
if options["domain"] is None or options["name"] is None: if options["domain"] is None or options["name"] is None:
print("\033[1;31mPlease provide both a domain and name.\033[0m\n", file=sys.stderr) print("\033[1;31mPlease provide both a domain and name.\033[0m\n", file=sys.stderr)
self.print_help("python2.7 manage.py", "create_realm") self.print_help("python manage.py", "create_realm")
exit(1) exit(1)
if options["open_realm"] and options["deployment_id"] is not None: if options["open_realm"] and options["deployment_id"] is not None:
print("\033[1;31mExternal deployments cannot be open realms.\033[0m\n", file=sys.stderr) print("\033[1;31mExternal deployments cannot be open realms.\033[0m\n", file=sys.stderr)
self.print_help("python2.7 manage.py", "create_realm") self.print_help("python manage.py", "create_realm")
exit(1) exit(1)
if options["deployment_id"] is not None and settings.VOYAGER: if options["deployment_id"] is not None and settings.VOYAGER:
print("\033[1;31mExternal deployments are not supported on voyager deployments.\033[0m\n", file=sys.stderr) print("\033[1;31mExternal deployments are not supported on voyager deployments.\033[0m\n", file=sys.stderr)

View File

@@ -29,7 +29,7 @@ This script can be used via two mechanisms:
environment variable. environment variable.
In Postfix, you can express that via an /etc/aliases entry like this: In Postfix, you can express that via an /etc/aliases entry like this:
|/usr/bin/env python2.7 /home/zulip/deployments/current/manage.py email-mirror |/usr/bin/env python /home/zulip/deployments/current/manage.py email-mirror
""" """

View File

@@ -23,7 +23,7 @@ class Command(BaseCommand):
This command should be used only on a newly created, empty Zulip instance to This command should be used only on a newly created, empty Zulip instance to
import a database dump from one or more JSON files. import a database dump from one or more JSON files.
Usage: python2.7 manage.py import_dump [--destroy-rebuild-database] [--chunk-size=%s] <json file name> [<json file name>...]""" % (DEFAULT_CHUNK_SIZE,) Usage: python manage.py import_dump [--destroy-rebuild-database] [--chunk-size=%s] <json file name> [<json file name>...]""" % (DEFAULT_CHUNK_SIZE,)
option_list = BaseCommand.option_list + ( option_list = BaseCommand.option_list + (
make_option('--destroy-rebuild-database', make_option('--destroy-rebuild-database',

View File

@@ -21,7 +21,7 @@ class Command(BaseCommand):
This is run as part of the nagios health check for the deliver_email command. This is run as part of the nagios health check for the deliver_email command.
Please note that this is only relevant to the SMTP-based email delivery (no Mandrill). Please note that this is only relevant to the SMTP-based email delivery (no Mandrill).
Usage: python2.7 manage.py print_email_delivery_backlog Usage: python manage.py print_email_delivery_backlog
""" """
def handle(self, *args, **options): def handle(self, *args, **options):

View File

@@ -10,9 +10,9 @@ import six
class Command(BaseCommand): class Command(BaseCommand):
help = """Manage emoji for the specified realm help = """Manage emoji for the specified realm
Example: python2.7 manage.py realm_emoji --realm=zulip.com --op=add robotheart https://humbug-user-avatars.s3.amazonaws.com/95ffa70fe0e7aea3c052ba91b38a28d8779f5705 Example: python manage.py realm_emoji --realm=zulip.com --op=add robotheart https://humbug-user-avatars.s3.amazonaws.com/95ffa70fe0e7aea3c052ba91b38a28d8779f5705
Example: python2.7 manage.py realm_emoji --realm=zulip.com --op=remove robotheart Example: python manage.py realm_emoji --realm=zulip.com --op=remove robotheart
Example: python2.7 manage.py realm_emoji --realm=zulip.com --op=show Example: python manage.py realm_emoji --realm=zulip.com --op=show
""" """
def add_arguments(self, parser): def add_arguments(self, parser):
@@ -40,13 +40,13 @@ Example: python2.7 manage.py realm_emoji --realm=zulip.com --op=show
name = options['name'] name = options['name']
if name is None: if name is None:
self.print_help("python2.7 manage.py", "realm_emoji") self.print_help("python manage.py", "realm_emoji")
sys.exit(1) sys.exit(1)
if options["op"] == "add": if options["op"] == "add":
img_url = options['img_url'] img_url = options['img_url']
if img_url is None: if img_url is None:
self.print_help("python2.7 manage.py", "realm_emoji") self.print_help("python manage.py", "realm_emoji")
sys.exit(1) sys.exit(1)
check_add_realm_emoji(realm, name, img_url) check_add_realm_emoji(realm, name, img_url)
sys.exit(0) sys.exit(0)
@@ -54,5 +54,5 @@ Example: python2.7 manage.py realm_emoji --realm=zulip.com --op=show
do_remove_realm_emoji(realm, name) do_remove_realm_emoji(realm, name)
sys.exit(0) sys.exit(0)
else: else:
self.print_help("python2.7 manage.py", "realm_emoji") self.print_help("python manage.py", "realm_emoji")
sys.exit(1) sys.exit(1)

View File

@@ -16,9 +16,9 @@ NOTE: Regexes must be simple enough that they can be easily translated to JavaSc
* Named groups will be converted to numbered groups automatically * Named groups will be converted to numbered groups automatically
* Inline-regex flags will be stripped, and where possible translated to RegExp-wide flags * Inline-regex flags will be stripped, and where possible translated to RegExp-wide flags
Example: python2.7 manage.py realm_filters --realm=zulip.com --op=add '#(?P<id>[0-9]{2,8})' 'https://trac.humbughq.com/ticket/%(id)s' Example: python manage.py realm_filters --realm=zulip.com --op=add '#(?P<id>[0-9]{2,8})' 'https://trac.humbughq.com/ticket/%(id)s'
Example: python2.7 manage.py realm_filters --realm=zulip.com --op=remove '#(?P<id>[0-9]{2,8})' Example: python manage.py realm_filters --realm=zulip.com --op=remove '#(?P<id>[0-9]{2,8})'
Example: python2.7 manage.py realm_filters --realm=zulip.com --op=show Example: python manage.py realm_filters --realm=zulip.com --op=show
""" """
def add_arguments(self, parser): def add_arguments(self, parser):
@@ -45,13 +45,13 @@ Example: python2.7 manage.py realm_filters --realm=zulip.com --op=show
pattern = options['pattern'] pattern = options['pattern']
if not pattern: if not pattern:
self.print_help("python2.7 manage.py", "realm_filters") self.print_help("python manage.py", "realm_filters")
sys.exit(1) sys.exit(1)
if options["op"] == "add": if options["op"] == "add":
url_format_string = options['url_format_string'] url_format_string = options['url_format_string']
if not url_format_string: if not url_format_string:
self.print_help("python2.7 manage.py", "realm_filters") self.print_help("python manage.py", "realm_filters")
sys.exit(1) sys.exit(1)
do_add_realm_filter(realm, pattern, url_format_string) do_add_realm_filter(realm, pattern, url_format_string)
sys.exit(0) sys.exit(0)
@@ -59,5 +59,5 @@ Example: python2.7 manage.py realm_filters --realm=zulip.com --op=show
do_remove_realm_filter(realm, pattern) do_remove_realm_filter(realm, pattern)
sys.exit(0) sys.exit(0)
else: else:
self.print_help("python2.7 manage.py", "realm_filters") self.print_help("python manage.py", "realm_filters")
sys.exit(1) sys.exit(1)

View File

@@ -35,7 +35,7 @@ class Command(BaseCommand):
def handle(self, **options): def handle(self, **options):
if options["domain"] is None or options["stream"] is None or \ if options["domain"] is None or options["stream"] is None or \
(options["users"] is None and options["all_users"] is None): (options["users"] is None and options["all_users"] is None):
self.print_help("python2.7 manage.py", "remove_users_from_stream") self.print_help("python manage.py", "remove_users_from_stream")
exit(1) exit(1)
realm = get_realm(options["domain"]) realm = get_realm(options["domain"])

View File

@@ -19,9 +19,9 @@ streams.
For example: For example:
python2.7 manage.py set_default_streams --domain=foo.com --streams=foo,bar,baz python manage.py set_default_streams --domain=foo.com --streams=foo,bar,baz
python2.7 manage.py set_default_streams --domain=foo.com --streams="foo,bar,baz with space" python manage.py set_default_streams --domain=foo.com --streams="foo,bar,baz with space"
python2.7 manage.py set_default_streams --domain=foo.com --streams= python manage.py set_default_streams --domain=foo.com --streams=
""" """
option_list = BaseCommand.option_list + ( option_list = BaseCommand.option_list + (

View File

@@ -33,7 +33,7 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
if None in (options["api"], options["web"], options["domain"]): if None in (options["api"], options["web"], options["domain"]):
print("\033[1;31mYou must provide a domain, an API URL, and a web URL.\033[0m\n", file=sys.stderr) print("\033[1;31mYou must provide a domain, an API URL, and a web URL.\033[0m\n", file=sys.stderr)
self.print_help("python2.7 manage.py", "create_realm") self.print_help("python manage.py", "create_realm")
exit(1) exit(1)
if not options["no_realm"]: if not options["no_realm"]:

View File

@@ -10,7 +10,7 @@ import time
class Command(BaseCommand): class Command(BaseCommand):
help = """Render all historical messages that haven't been rendered yet. help = """Render all historical messages that haven't been rendered yet.
Usage: python2.7 manage.py render_old_messages""" Usage: python manage.py render_old_messages"""
def handle(self, *args, **options): def handle(self, *args, **options):
total_rendered = 0 total_rendered = 0