##// END OF EJS Templates
implement active_types via formatter.enabled attributes...
MinRK -
Show More
@@ -63,7 +63,14 b' class DisplayFormatter(Configurable):'
63 help="""List of currently active mime-types""")
63 help="""List of currently active mime-types""")
64 def _active_types_default(self):
64 def _active_types_default(self):
65 return self.format_types
65 return self.format_types
66
66
67 def _active_types_changed(self, name, old, new):
68 for key, formatter in self.formatters.keys():
69 if key in new:
70 formatter.enabled = True
71 else:
72 formatter.enabled = False
73
67 # A dict of formatter whose keys are format types (MIME types) and whose
74 # A dict of formatter whose keys are format types (MIME types) and whose
68 # values are subclasses of BaseFormatter.
75 # values are subclasses of BaseFormatter.
69 formatters = Dict()
76 formatters = Dict()
@@ -109,7 +116,6 b' class DisplayFormatter(Configurable):'
109 A list of format type strings (MIME types) to include in the
116 A list of format type strings (MIME types) to include in the
110 format data dict. If this is set *only* the format types included
117 format data dict. If this is set *only* the format types included
111 in this list will be computed.
118 in this list will be computed.
112 If unspecified, `active_types` will be used.
113 exclude : list or tuple, optional
119 exclude : list or tuple, optional
114 A list of format type string (MIME types) to exclude in the format
120 A list of format type string (MIME types) to exclude in the format
115 data dict. If this is set all format types will be computed,
121 data dict. If this is set all format types will be computed,
@@ -125,8 +131,6 b' class DisplayFormatter(Configurable):'
125 that format.
131 that format.
126 """
132 """
127 format_dict = {}
133 format_dict = {}
128 if include is None:
129 include = self.active_types
130
134
131 for format_type, formatter in self.formatters.items():
135 for format_type, formatter in self.formatters.items():
132 if format_type not in include:
136 if format_type not in include:
General Comments 0
You need to be logged in to leave comments. Login now