return self.__unicode__()
def __repr__(self):
- return self.__unicode__()
+ return '<%s>' % self.__unicode__().replace('\n',';')
def __unicode__(self):
lines = ['%s:' % self.__class__.__name__]
value = getattr(self, field)
if value == None:
continue
- value_lines = unicode(value).splitlines()
- if isinstance(value, AttributeHolder):
- prefix = ' '
+ if isinstance(value, (tuple, list)):
+ for v in value:
+ lines.extend(self._format_value(field, v))
else:
- prefix = ' %s: ' % field
- lines.extend(['%s%s' % (prefix, L) for L in value_lines])
+ lines.extend(self._format_value(field, value))
return u'\n'.join(lines)
+ def _format_value(self, field, value):
+ value_lines = unicode(value).splitlines()
+ if isinstance(value, AttributeHolder):
+ prefix = ' '
+ else:
+ prefix = ' %s: ' % field
+ return ['%s%s' % (prefix, L) for L in value_lines]
class Name (AttributeHolder):
fields = ['first_middle', 'last']
fields = ['college', 'title', 'year']
class Contact (AttributeHolder):
- fields = ['office', 'website', 'phone', 'lab', 'lab_phone']
+ fields = ['office', 'email', 'website', 'phone', 'lab', 'lab_phone']
class Bio (AttributeHolder):
fields = ['specialization', 'publications', 'profile', 'cv']
class Professor (AttributeHolder):
- fields = ['name', 'graduations', 'contact', 'bio']
+ fields = ['name', 'title', 'graduations', 'contact', 'bio']
+
+# LocalWords: SiteCorePy