(self, header, data, content_type=None, sort=True)
| 119 | self._write(data, content_type=content_type) |
| 120 | |
| 121 | def string(self, header, data, content_type=None, sort=True): |
| 122 | if conf.api: |
| 123 | self._write(data, content_type=content_type) |
| 124 | |
| 125 | if isListLike(data) and len(data) == 1: |
| 126 | data = unArrayizeValue(data) |
| 127 | |
| 128 | if isListLike(data): |
| 129 | self.lister(header, data, content_type, sort) |
| 130 | elif data is not None: |
| 131 | _ = getUnicode(data) |
| 132 | |
| 133 | if _.endswith("\r\n"): |
| 134 | _ = _[:-2] |
| 135 | |
| 136 | elif _.endswith("\n"): |
| 137 | _ = _[:-1] |
| 138 | |
| 139 | if _.strip(' '): |
| 140 | _ = _.strip(' ') |
| 141 | |
| 142 | if "\n" in _: |
| 143 | self._write("%s:\n---\n%s\n---" % (header, _)) |
| 144 | else: |
| 145 | self._write("%s: %s" % (header, ("'%s'" % _) if isinstance(data, six.string_types) else _)) |
| 146 | |
| 147 | def lister(self, header, elements, content_type=None, sort=True): |
| 148 | if elements and sort: |
no test coverage detected