X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=PLC%2FPersons.py;h=ee01550e9fd5ce29ac296a247a1630604c74b151;hb=3f5cfa865d7b3649445fbb9af290901bf65fd4fc;hp=8eb882ce5323c7ae1f6d02f699608b053cbcd2bd;hpb=d4c7b1e8c3769ba88add9fec6becd5516962d803;p=plcapi.git diff --git a/PLC/Persons.py b/PLC/Persons.py index 8eb882c..ee01550 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -68,22 +68,6 @@ class Person(Row): Parameter(str, "Slice name"))] } - - - # for Cache - class_key = 'email' - foreign_fields = ['first_name', 'last_name', 'title', 'email', 'phone', 'url', - 'bio', 'enabled', 'password', ] - # forget about these ones, they are read-only anyway - # handling them causes Cache to re-sync all over again - # 'last_updated', 'date_created' - foreign_xrefs = [ - {'field' : 'key_ids', 'class': 'Key', 'table' : 'person_key' } , - {'field' : 'site_ids', 'class': 'Site', 'table' : 'person_site'}, -# xxx this is not handled by Cache yet -# 'role_ids': Parameter([int], "List of role identifiers"), -] - def validate_email(self, email): """ Validate email address. Stolen from Mailman. @@ -251,10 +235,10 @@ class Person(Row): assert 'person_id' in self assert isinstance(value, list) - (role_ids, roles_names) = self.separate_types(value)[0:2] + (role_ids, role_names) = self.separate_types(value)[0:2] # Translate roles into role_ids - if roles_names: + if role_names: roles = Roles(self.api, role_names, ['role_id']).dict('role_id') role_ids += roles.keys() @@ -394,8 +378,7 @@ class Persons(Table): def __init__(self, api, person_filter = None, columns = None): Table.__init__(self, api, Person, columns) - #sql = "SELECT %s FROM view_persons WHERE deleted IS False" % \ - # ", ".join(self.columns) + foreign_fields = {'role_ids': ('role_id', 'person_role'), 'roles': ('name', 'roles'), 'site_ids': ('site_id', 'person_site'),