##// END OF EJS Templates
Repr style out for widgets
Jonathan Frederic -
Show More
@@ -149,27 +149,30 b' class DisplayFormatter(Configurable):'
149 format_dict = {}
149 format_dict = {}
150 md_dict = {}
150 md_dict = {}
151
151
152 for format_type, formatter in self.formatters.items():
152 # If _ipython_display_ is defined, use that to display this object. If
153 if include and format_type not in include:
153 # it returns NotImplemented, use the _repr_ logic (default).
154 continue
154 if not hasattr(obj, '_ipython_display_') or obj._ipython_display_(**kwargs) == NotImplemented:
155 if exclude and format_type in exclude:
155 for format_type, formatter in self.formatters.items():
156 continue
156 if include and format_type not in include:
157
157 continue
158 md = None
158 if exclude and format_type in exclude:
159 try:
159 continue
160 data = formatter(obj)
160
161 except:
161 md = None
162 # FIXME: log the exception
162 try:
163 raise
163 data = formatter(obj)
164
164 except:
165 # formatters can return raw data or (data, metadata)
165 # FIXME: log the exception
166 if isinstance(data, tuple) and len(data) == 2:
166 raise
167 data, md = data
167
168
168 # formatters can return raw data or (data, metadata)
169 if data is not None:
169 if isinstance(data, tuple) and len(data) == 2:
170 format_dict[format_type] = data
170 data, md = data
171 if md is not None:
171
172 md_dict[format_type] = md
172 if data is not None:
173 format_dict[format_type] = data
174 if md is not None:
175 md_dict[format_type] = md
173
176
174 return format_dict, md_dict
177 return format_dict, md_dict
175
178
General Comments 0
You need to be logged in to leave comments. Login now