##// END OF EJS Templates
ENH: Use text/plain for the format string of the DefaultFormatter....
Robert Kern -
Show More
@@ -53,7 +53,8 b' class DefaultFormatter(Configurable):'
53 53 id = Str('default')
54 54
55 55 # The kind of data returned.
56 format = Str('text')
56 # This is often, but not always a MIME type.
57 format = Str('text/plain')
57 58
58 59 # Whether to pretty-print or not.
59 60 pprint = Bool(True, config=True)
@@ -143,12 +144,17 b' class FormatterABC(object):'
143 144 id = 'abstract'
144 145
145 146 # The kind of data returned.
146 format = 'text'
147 format = 'text/plain'
147 148
148 149 @abc.abstractmethod
149 150 def __call__(self, obj):
150 151 """ Return a JSONable representation of the object.
152
153 If the object cannot be formatted by this formatter, then return None
151 154 """
152 return repr(obj)
155 try:
156 return repr(obj)
157 except TypeError:
158 return None
153 159
154 160 FormatterABC.register(DefaultFormatter)
General Comments 0
You need to be logged in to leave comments. Login now