mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
@@ -195,6 +195,6 @@ for i in itertools.count():
|
|||||||
if not i % 10:
|
if not i % 10:
|
||||||
populate_events()
|
populate_events()
|
||||||
send_reminders()
|
send_reminders()
|
||||||
except:
|
except Exception:
|
||||||
logging.exception("Couldn't download Google calendar and/or couldn't post to Zulip.")
|
logging.exception("Couldn't download Google calendar and/or couldn't post to Zulip.")
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class ZulipToJabberBot(object):
|
|||||||
self.stream_message(message)
|
self.stream_message(message)
|
||||||
elif message['type'] == 'private':
|
elif message['type'] == 'private':
|
||||||
self.private_message(message)
|
self.private_message(message)
|
||||||
except:
|
except Exception:
|
||||||
logging.exception("Exception forwarding Zulip => Jabber")
|
logging.exception("Exception forwarding Zulip => Jabber")
|
||||||
elif event['type'] == 'subscription':
|
elif event['type'] == 'subscription':
|
||||||
self.process_subscription(event)
|
self.process_subscription(event)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ def run_forever():
|
|||||||
run()
|
run()
|
||||||
remove_error_stamp_file(error_file_path)
|
remove_error_stamp_file(error_file_path)
|
||||||
print('done')
|
print('done')
|
||||||
except:
|
except Exception:
|
||||||
add_error_stamp_file(error_file_path)
|
add_error_stamp_file(error_file_path)
|
||||||
print('\n\n\n\033[91mPLEASE FIX!!\033[0m\n\n')
|
print('\n\n\n\033[91mPLEASE FIX!!\033[0m\n\n')
|
||||||
|
|
||||||
|
|||||||
@@ -45,15 +45,15 @@ def encode_info(info):
|
|||||||
try:
|
try:
|
||||||
info = ujson.loads(info)
|
info = ujson.loads(info)
|
||||||
result = '(stringified)\n'
|
result = '(stringified)\n'
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
result += cgi.escape(pprint.pformat(info, indent=4))
|
result += cgi.escape(pprint.pformat(info, indent=4))
|
||||||
return '<pre>' + result + '</pre>'
|
return '<pre>' + result + '</pre>'
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
return cgi.escape(str(info))
|
return cgi.escape(str(info))
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return 'NOT ENCODABLE'
|
return 'NOT ENCODABLE'
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ def create_single_page(pattern, out_dir, href, calls):
|
|||||||
f.write('<div class="test">')
|
f.write('<div class="test">')
|
||||||
try:
|
try:
|
||||||
f.write(call['url'])
|
f.write(call['url'])
|
||||||
except:
|
except Exception:
|
||||||
f.write(call['url'].encode('utf8'))
|
f.write(call['url'].encode('utf8'))
|
||||||
f.write('<br>\n')
|
f.write('<br>\n')
|
||||||
f.write(call['method'] + '<br>\n')
|
f.write(call['method'] + '<br>\n')
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ def server_is_up(server, log_file):
|
|||||||
try:
|
try:
|
||||||
# We could get a 501 error if the reverse proxy is up but the Django app isn't.
|
# We could get a 501 error if the reverse proxy is up but the Django app isn't.
|
||||||
return requests.get('http://127.0.0.1:9981/accounts/home').status_code == 200
|
return requests.get('http://127.0.0.1:9981/accounts/home').status_code == 200
|
||||||
except:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def review_pr():
|
|||||||
# type: () -> None
|
# type: () -> None
|
||||||
try:
|
try:
|
||||||
pull_id = int(sys.argv[1])
|
pull_id = int(sys.argv[1])
|
||||||
except:
|
except Exception:
|
||||||
exit('please provide an integer pull request id')
|
exit('please provide an integer pull request id')
|
||||||
|
|
||||||
ensure_on_clean_master()
|
ensure_on_clean_master()
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ try:
|
|||||||
for s in (signal.SIGINT, signal.SIGTERM):
|
for s in (signal.SIGINT, signal.SIGTERM):
|
||||||
signal.signal(s, shutdown_handler)
|
signal.signal(s, shutdown_handler)
|
||||||
ioloop.start()
|
ioloop.start()
|
||||||
except:
|
except Exception:
|
||||||
# Print the traceback before we get SIGTERM and die.
|
# Print the traceback before we get SIGTERM and die.
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -776,7 +776,7 @@ def compute_mit_user_fullname(email):
|
|||||||
return match_user.group(1).lower() + "@" + match_user.group(2).upper()[1:]
|
return match_user.group(1).lower() + "@" + match_user.group(2).upper()[1:]
|
||||||
except DNS.Base.ServerError:
|
except DNS.Base.ServerError:
|
||||||
pass
|
pass
|
||||||
except:
|
except Exception:
|
||||||
print("Error getting fullname for %s:" % (email,))
|
print("Error getting fullname for %s:" % (email,))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return email.lower()
|
return email.lower()
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ def fetch_open_graph_image(url):
|
|||||||
# TODO: What if response content is huge? Should we get headers first?
|
# TODO: What if response content is huge? Should we get headers first?
|
||||||
try:
|
try:
|
||||||
content = requests.get(url, timeout=1).text
|
content = requests.get(url, timeout=1).text
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Extract the head and meta tags
|
# Extract the head and meta tags
|
||||||
@@ -553,7 +553,7 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
|
|||||||
img.set('src', media_url)
|
img.set('src', media_url)
|
||||||
|
|
||||||
return tweet
|
return tweet
|
||||||
except:
|
except Exception:
|
||||||
# We put this in its own try-except because it requires external
|
# We put this in its own try-except because it requires external
|
||||||
# connectivity. If Twitter flakes out, we don't want to not-render
|
# connectivity. If Twitter flakes out, we don't want to not-render
|
||||||
# the entire message; we just want to not show the Twitter preview.
|
# the entire message; we just want to not show the Twitter preview.
|
||||||
@@ -1369,7 +1369,7 @@ def do_convert(content, message=None, message_realm=None, possible_words=None, s
|
|||||||
# Sometimes Python-Markdown is really slow; see
|
# Sometimes Python-Markdown is really slow; see
|
||||||
# https://trac.zulip.net/ticket/345
|
# https://trac.zulip.net/ticket/345
|
||||||
return timeout(5, _md_engine.convert, content)
|
return timeout(5, _md_engine.convert, content)
|
||||||
except:
|
except Exception:
|
||||||
from zerver.lib.actions import internal_send_message
|
from zerver.lib.actions import internal_send_message
|
||||||
from zerver.models import get_user_profile_by_email
|
from zerver.models import get_user_profile_by_email
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class _RateLimitFilter(object):
|
|||||||
try:
|
try:
|
||||||
cache.set('RLF_TEST_KEY', 1, 1)
|
cache.set('RLF_TEST_KEY', 1, 1)
|
||||||
use_cache = cache.get('RLF_TEST_KEY') == 1
|
use_cache = cache.get('RLF_TEST_KEY') == 1
|
||||||
except:
|
except Exception:
|
||||||
use_cache = False
|
use_cache = False
|
||||||
|
|
||||||
if use_cache:
|
if use_cache:
|
||||||
|
|||||||
@@ -146,14 +146,14 @@ def has_request_variables(view_func):
|
|||||||
val = param.converter(val)
|
val = param.converter(val)
|
||||||
except JsonableError:
|
except JsonableError:
|
||||||
raise
|
raise
|
||||||
except:
|
except Exception:
|
||||||
raise RequestVariableConversionError(param.post_var_name, val)
|
raise RequestVariableConversionError(param.post_var_name, val)
|
||||||
|
|
||||||
# Validators are like converters, but they don't handle JSON parsing; we do.
|
# Validators are like converters, but they don't handle JSON parsing; we do.
|
||||||
if param.validator is not None and not default_assigned:
|
if param.validator is not None and not default_assigned:
|
||||||
try:
|
try:
|
||||||
val = ujson.loads(val)
|
val = ujson.loads(val)
|
||||||
except:
|
except Exception:
|
||||||
raise JsonableError(_('argument "%s" is not valid json.') % (param.post_var_name,))
|
raise JsonableError(_('argument "%s" is not valid json.') % (param.post_var_name,))
|
||||||
|
|
||||||
error = param.validator(param.post_var_name, val)
|
error = param.validator(param.post_var_name, val)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Command(BaseCommand):
|
|||||||
user_id = int(key.split(':')[1])
|
user_id = int(key.split(':')[1])
|
||||||
try:
|
try:
|
||||||
user = get_user_profile_by_id(user_id)
|
user = get_user_profile_by_id(user_id)
|
||||||
except:
|
except Exception:
|
||||||
user = None
|
user = None
|
||||||
max_calls = max_api_calls(user=user)
|
max_calls = max_api_calls(user=user)
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class Command(BaseCommand):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
user_profile = UserProfile.objects.get(api_key=options['api_key'])
|
user_profile = UserProfile.objects.get(api_key=options['api_key'])
|
||||||
except:
|
except Exception:
|
||||||
print("Unable to get user profile for api key %s" % (options['api_key'],))
|
print("Unable to get user profile for api key %s" % (options['api_key'],))
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
|
|||||||
try:
|
try:
|
||||||
callback, param_dict = resolver.resolve404()
|
callback, param_dict = resolver.resolve404()
|
||||||
response = callback(request, **param_dict)
|
response = callback(request, **param_dict)
|
||||||
except:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
response = self.handle_uncaught_exception(request, resolver,
|
response = self.handle_uncaught_exception(request, resolver,
|
||||||
sys.exc_info())
|
sys.exc_info())
|
||||||
@@ -247,7 +247,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
|
|||||||
try:
|
try:
|
||||||
callback, param_dict = resolver.resolve403()
|
callback, param_dict = resolver.resolve403()
|
||||||
response = callback(request, **param_dict)
|
response = callback(request, **param_dict)
|
||||||
except:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
response = self.handle_uncaught_exception(request,
|
response = self.handle_uncaught_exception(request,
|
||||||
resolver, sys.exc_info())
|
resolver, sys.exc_info())
|
||||||
@@ -281,7 +281,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
|
|||||||
response = middleware_method(request, response)
|
response = middleware_method(request, response)
|
||||||
if hasattr(self, 'apply_response_fixes'):
|
if hasattr(self, 'apply_response_fixes'):
|
||||||
response = self.apply_response_fixes(request, response)
|
response = self.apply_response_fixes(request, response)
|
||||||
except: # Any exception should be gathered and handled
|
except Exception: # Any exception should be gathered and handled
|
||||||
signals.got_request_exception.send(sender=self.__class__, request=request)
|
signals.got_request_exception.send(sender=self.__class__, request=request)
|
||||||
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
|
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ try:
|
|||||||
def instrument_tornado_ioloop():
|
def instrument_tornado_ioloop():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
ioloop._poll = InstrumentedPoll # type: ignore # cross-version type variation is hard for mypy
|
ioloop._poll = InstrumentedPoll # type: ignore # cross-version type variation is hard for mypy
|
||||||
except:
|
except Exception:
|
||||||
# Tornado 3
|
# Tornado 3
|
||||||
from tornado.ioloop import IOLoop, PollIOLoop
|
from tornado.ioloop import IOLoop, PollIOLoop
|
||||||
# There isn't a good way to get at what the underlying poll implementation
|
# There isn't a good way to get at what the underlying poll implementation
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ def api_pagerduty_webhook(request, user_profile, client, payload=REQ(argument_ty
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
format_dict = build_pagerduty_formatdict(message)
|
format_dict = build_pagerduty_formatdict(message)
|
||||||
except:
|
except Exception:
|
||||||
send_raw_pagerduty_json(user_profile, client, stream, message, topic)
|
send_raw_pagerduty_json(user_profile, client, stream, message, topic)
|
||||||
else:
|
else:
|
||||||
send_formated_pagerduty(user_profile, client, stream, message_type, format_dict, topic)
|
send_formated_pagerduty(user_profile, client, stream, message_type, format_dict, topic)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ def api_pivotal_webhook(request, user_profile, client, stream=REQ()):
|
|||||||
subject, content = api_pivotal_webhook_v3(request, user_profile, stream)
|
subject, content = api_pivotal_webhook_v3(request, user_profile, stream)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return json_error(_("Failed to extract data from Pivotal XML response"))
|
return json_error(_("Failed to extract data from Pivotal XML response"))
|
||||||
except:
|
except Exception:
|
||||||
# Attempt to parse v5 JSON payload
|
# Attempt to parse v5 JSON payload
|
||||||
try:
|
try:
|
||||||
subject, content = api_pivotal_webhook_v5(request, user_profile, stream)
|
subject, content = api_pivotal_webhook_v5(request, user_profile, stream)
|
||||||
|
|||||||
Reference in New Issue
Block a user