sosmessage.py
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# vim:set ft=python ts=4 sw=4 sts=4 autoindent:
'''
Dummy Messager that can replace the real one in case it goes down.
Doesn't actually send any messages other than letting the user
know of the problem.
Use e.g. as
try:
from message import Messager
except:
from sosmessage import Messager
'''
class SosMessager:
def output_json(json_dict):
json_dict['messages'] = [['HELP: messager down! (internal error in message.py, please contact administrator)','error', -1]]
return json_dict
output_json = staticmethod(output_json)
def output(o):
print >> o, 'HELP: messager down! (internal error in message.py, please contact administrator)'
output = staticmethod(output)
def info(msg, duration=3, escaped=False): pass
info = staticmethod(info)
def warning(msg, duration=3, escaped=False): pass
warning = staticmethod(warning)
def error(msg, duration=3, escaped=False): pass
error = staticmethod(error)
def debug(msg, duration=3, escaped=False): pass
debug = staticmethod(debug)