From a2a1867f25f352f1c746810d0c8c4adc3923568e Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Thu, 10 Oct 2013 15:30:35 -0400 Subject: [PATCH] Only render tweets if we have credentials (imported from commit 46c59f430aeae87a832f33d2ccb85209f9caec74) --- zerver/lib/bugdown/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index 10c4cec901..bdc8dd6f7c 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -82,6 +82,12 @@ def fetch_tweet_data(tweet_id): import testing_mocks res = testing_mocks.twitter(tweet_id) else: + if settings.TWITTER_CONSUMER_KEY == '' or \ + settings.TWITTER_CONSUMER_SECRET == '' or \ + settings.TWITTER_ACCESS_TOKEN_KEY == '' or \ + settings.TWITTER_ACCESS_TOKEN_SECRET == '': + return None + api = twitter.Api(consumer_key = settings.TWITTER_CONSUMER_KEY, consumer_secret = settings.TWITTER_CONSUMER_SECRET, access_token_key = settings.TWITTER_ACCESS_TOKEN_KEY,