Show More
@@ -1,19 +1,20 | |||
|
1 | 1 | DisplayFormatter changes |
|
2 | 2 | ======================== |
|
3 | 3 | |
|
4 | 4 | There was no official way to query or remove callbacks in the Formatter API. |
|
5 | 5 | To remedy this, the following methods are added to :class:`BaseFormatter`: |
|
6 | 6 | |
|
7 | 7 | - ``lookup(instance)`` - return appropriate callback or a given object |
|
8 | 8 | - ``lookup_by_type(type_or_str)`` - return appropriate callback for a given type or ``'mod.name'`` type string |
|
9 |
- ``pop(type_or_str)`` - remove a |
|
|
9 | - ``pop(type_or_str)`` - remove a type (by type or string). | |
|
10 | Pass a second argument to avoid KeyError (like dict). | |
|
10 | 11 | |
|
11 | 12 | All of the above methods raise a KeyError if no match is found. |
|
12 | 13 | |
|
13 | 14 | And the following methods are changed: |
|
14 | 15 | |
|
15 | 16 | - ``for_type(type_or_str)`` - behaves the same as before, only adding support for ``'mod.name'`` |
|
16 | 17 | type strings in addition to plain types. This removes the need for ``for_type_by_name()``, |
|
17 | 18 | but it remains for backward compatibility. |
|
18 | 19 | |
|
19 | 20 |
General Comments 0
You need to be logged in to leave comments.
Login now