def _repr_html_(self): if len(self) <= 10: items = [escape(pformat(item)) for item in self[:]] else: items = ( [escape(pformat(item)) for item in self[:5]] + ["<strong>...</strong>"] + [escape(pformat(item)) for item in self[-5:]] ) return """<table> <thead> <tr> <th><code>PaginatedList({params})</code>: <em>{count}</em> items</th> </tr> </thead> <tbody>{items}</tbody> </table>""".format( params=", ".join( ["{}.{}".format(self._binding.owner.__name__, self._binding.link.rel)] + ["{}={}".format(k, repr(v)) for k, v in self._request_params.items()] ), count=self._total_count, items="\n".join("<tr><td><code>{}</code></td></tr>".format(item) for item in items), )
def _repr_html_(self): return '''<table> <thead> <tr> <th colspan="2"><code>{cls}({id})</code></th> </tr> </thead> <tbody>{properties}</tbody> </table>'''.format( cls=self.__class__.__name__, id=escape(repr(self.id)), properties='\n'.join('<tr><td>{}</td><td><code>{}</code></td>'.format(escape(k), escape(pformat(v))) for k, v in self._properties.items() if not k.startswith('$')))
def _repr_html_(self): if len(self) <= 10: items = [escape(pformat(item)) for item in self[:]] else: items = [escape(pformat(item)) for item in self[:5]] + \ ['<strong>...</strong>'] + \ [escape(pformat(item)) for item in self[-5:]] return '''<table> <thead> <tr> <th><code>PaginatedList({params})</code>: <em>{count}</em> items</th> </tr> </thead> <tbody>{items}</tbody> </table>'''.format( params=', '.join(['{}.{}'.format(self._binding.owner.__name__, self._binding.link.rel)] + ['{}={}'.format(k, repr(v)) for k, v in self._request_params.items()]), count=self._total_count, items='\n'.join('<tr><td><code>{}</code></td></tr>'.format(item) for item in items))