X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FSetPersonPrimarySite.py;h=9fcb2ec7b85b8265db8c1a69cb061c5b13d438aa;hb=b6795007cf7200e698ffd7bef79747995ca719a0;hp=d0d392b30160c7c0a50c2b06271eac89ec655864;hpb=f5cd72e35593c96b9996ab4e49674cccc7525c48;p=plcapi.git diff --git a/PLC/Methods/SetPersonPrimarySite.py b/PLC/Methods/SetPersonPrimarySite.py index d0d392b..9fcb2ec 100644 --- a/PLC/Methods/SetPersonPrimarySite.py +++ b/PLC/Methods/SetPersonPrimarySite.py @@ -1,5 +1,3 @@ -# $Id$ -# $URL$ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed @@ -33,11 +31,11 @@ class SetPersonPrimarySite(Method): # Get account information persons = Persons(self.api, [person_id_or_email]) if not persons: - raise PLCInvalidArgument, "No such account" + raise PLCInvalidArgument("No such account") person = persons[0] if person['peer_id'] is not None: - raise PLCInvalidArgument, "Not a local account" + raise PLCInvalidArgument("Not a local account") # Authenticated function assert self.caller is not None @@ -45,19 +43,19 @@ class SetPersonPrimarySite(Method): # Non-admins can only update their own primary site if 'admin' not in self.caller['roles'] and \ self.caller['person_id'] != person['person_id']: - raise PLCPermissionDenied, "Not allowed to update specified account" + raise PLCPermissionDenied("Not allowed to update specified account") # Get site information sites = Sites(self.api, [site_id_or_login_base]) if not sites: - raise PLCInvalidArgument, "No such site" + raise PLCInvalidArgument("No such site") site = sites[0] if site['peer_id'] is not None: - raise PLCInvalidArgument, "Not a local site" + raise PLCInvalidArgument("Not a local site") if site['site_id'] not in person['site_ids']: - raise PLCInvalidArgument, "Not a member of the specified site" + raise PLCInvalidArgument("Not a member of the specified site") person.set_primary_site(site)