16412f768cc2417dda98af07c27991822647e35c
[wolnelektury.git] / catalogue / lib / dcparser / person.py
1 # -*- coding: utf-8 -*-
2
3
4 class Person(object):
5     """Single person with last name and a list of first names."""
6     def __init__(self, last_name, *first_names):
7         self.last_name = last_name
8         self.first_names = first_names
9     
10     
11     def __eq__(self, right):
12         return self.last_name == right.last_name and self.first_names == right.first_names
13     
14     
15     def __unicode__(self):
16         if len(self.first_names) > 0:
17             return '%s, %s' % (self.last_name, ' '.join(self.first_names))
18         else:
19             return self.last_name
20     
21     
22     def __repr__(self):
23         return 'Person(last_name=%r, first_names=*%r)' % (self.last_name, self.first_names)
24