7 v = getattr(self, field, None)
9 return self._default.get(field)
12 def _formatField(self, field):
14 func = self._format.get(field)
19 if not hasattr(v, '__iter__'):
23 return '[%d x %s]'%(len(v), type(v[0]).__name__)
27 return [cls._identity_field]
30 ignore = self._ignore()
31 keys = sorted(self.c.keys())
32 return [(k,self._formatField(k)) for k in keys if k not in ignore]
35 classname = self.__class__.__name__
37 if self._identity_field:
38 identity = self.__dict__.get(self._identity_field)
39 identity = ' ' + (identity and repr(identity) or 'hash=%X'%hash(self))
43 payload = " ".join(["%s=%s" % (k, v) for k,v in self._fields()])
45 payload = ": "+payload
47 return "<%s%s%s>" % (classname, identity, payload)