X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3618eb351066fde7992f64c81a053d0a89db2235..e180078f82a3d7e73857a9544b3b7fdfd475f93f:/lib/dcparser/person.py diff --git a/lib/dcparser/person.py b/lib/dcparser/person.py new file mode 100644 index 000000000..16412f768 --- /dev/null +++ b/lib/dcparser/person.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + + +class Person(object): + """Single person with last name and a list of first names.""" + def __init__(self, last_name, *first_names): + self.last_name = last_name + self.first_names = first_names + + + def __eq__(self, right): + return self.last_name == right.last_name and self.first_names == right.first_names + + + def __unicode__(self): + if len(self.first_names) > 0: + return '%s, %s' % (self.last_name, ' '.join(self.first_names)) + else: + return self.last_name + + + def __repr__(self): + return 'Person(last_name=%r, first_names=*%r)' % (self.last_name, self.first_names) +