X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FPersons.py;h=76487304f8111d6f76689c51f1917b53a6a8171f;hb=f1f66aa544638f31d63561a4a9e15eb45bd0c319;hp=518f53cdedf7b226cdc76fc599956deb151b4782;hpb=259f989816ec6cd9beb1c0549dc08aa78205cc20;p=plcapi.git diff --git a/PLC/Persons.py b/PLC/Persons.py index 518f53c..7648730 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -19,7 +19,7 @@ from PLC.Table import Row, Table from PLC.Roles import Role, Roles from PLC.Keys import Key, Keys from PLC.Messages import Message, Messages -from PLC.Storage.AlchemyObj import AlchemyObj +from PLC.Storage.AlchemyObject import AlchemyObj class Person(AlchemyObj): """ @@ -28,8 +28,10 @@ class Person(AlchemyObj): dict. Commit to the database with sync(). """ + tablename = 'persons' + fields = { - 'person_id': Parameter(int, "User identifier"), + 'person_id': Parameter(int, "User identifier", primary_key=True), 'keystone_id': Parameter(int, "Keystone User identifier"), 'first_name': Parameter(str, "Given name", max = 128), 'last_name': Parameter(str, "Surname", max = 128), @@ -141,6 +143,7 @@ class Person(AlchemyObj): def delete(self): + assert 'person_id' in self # delete relationships SlicePerson().delete.filter({'person_id': self['person_id']})