def __str__(self):
lines = []
lines.append("{0:s} object, bound to {1:s}.".format(self.__class__.__name__, self._cb.session.server))
if self._last_refresh_time:
lines.append(" Last refreshed at {0:s}".format(time.ctime(self._last_refresh_time)))
if not self._full_init:
lines.append(" Partially initialized. Use .refresh() to load all attributes")
lines.append("-"*79)
lines.append("")
for attr in sorted(self._info):
status = " "
if attr in self._dirty_attributes:
if self._dirty_attributes[attr] is None:
status = "(+)"
else:
status = "(*)"
val = str(self._info[attr])
if len(val) > 50:
val = val[:47] + u"..."
lines.append(u"{0:s} {1:>20s}: {2:s}".format(status, attr, val))
return "\n".join(lines)
评论列表
文章目录