zephyr_mirror: forward messages in test mode if the site is not the default one

(imported from commit 7d504a6d555866f12f1657b522b4e6eb380c64a3)
This commit is contained in:
Zev Benjamin 2012-11-13 18:02:35 -05:00 committed by Tim Abbott
parent 73daa73887
commit 1a4f97a874

View file

@ -13,6 +13,8 @@ import textwrap
import signal import signal
import logging import logging
DEFAULT_SITE = "https://humbughq.com"
def to_humbug_username(zephyr_username): def to_humbug_username(zephyr_username):
if "@" in zephyr_username: if "@" in zephyr_username:
(user, realm) = zephyr_username.split("@") (user, realm) = zephyr_username.split("@")
@ -100,7 +102,7 @@ def send_humbug(zeph):
message["recipient"] = zeph["recipient"] message["recipient"] = zeph["recipient"]
message['content'] = unwrap_lines(zeph['content']) message['content'] = unwrap_lines(zeph['content'])
if options.test_mode: if options.test_mode and options.site == DEFAULT_SITE:
logger.debug("Message is: %s" % (str(message),)) logger.debug("Message is: %s" % (str(message),))
return {'result': "success"} return {'result': "success"}
@ -597,7 +599,7 @@ if __name__ == "__main__":
action='store_true') action='store_true')
parser.add_option('--site', parser.add_option('--site',
dest='site', dest='site',
default="https://humbughq.com", default=DEFAULT_SITE,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store') action='store')
parser.add_option('--user', parser.add_option('--user',