def visitDynamicAttributes(self, attrs): classes = [] params = [] for attr in attrs: if attr["name"] == "class": value = self._get_value(attr) if isinstance(value, list): classes.extend(value) else: classes.append(value) else: value = self._get_value(attr) if value not in (None, False): params.append((attr["name"], escape(value))) if classes: classes = [six.text_type(c) for c in classes] params.append(("class", " ".join(classes))) if params: self.buf.append(" " + " ".join([process_param(k, v, self.terse) for (k, v) in params]))
def visitDynamicAttributes(self, attrs): classes = [] params = [] for attr in attrs: if attr['name'] == 'class': value = self._get_value(attr) if isinstance(value, list): classes.extend(value) else: classes.append(value) else: value = self._get_value(attr) if value is True: params.append((attr['name'], True)) elif value not in (None,False): params.append((attr['name'], escape(value))) if classes: classes = [six.text_type(c) for c in classes] params.append(('class', " ".join(classes))) if params: self.buf.append(" "+" ".join([process_param(k, v, self.terse) for (k,v) in params]))