- does basically the same thing as Cache.py, except since we have cached
[plcapi.git] / PLC / Methods / SetPersonPrimarySite.py
index 61ab287..9eff75c 100644 (file)
@@ -30,9 +30,11 @@ class SetPersonPrimarySite(Method):
         persons = Persons(self.api, [person_id_or_email])
         if not persons:
             raise PLCInvalidArgument, "No such account"
-
         person = persons[0]
 
+        if person['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local account"
+
         # Authenticated function
         assert self.caller is not None
 
@@ -45,9 +47,11 @@ class SetPersonPrimarySite(Method):
         sites = Sites(self.api, [site_id_or_login_base])
         if not sites:
             raise PLCInvalidArgument, "No such site"
-
         site = sites[0]
 
+        if site['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local site"
+
         if site['site_id'] not in person['site_ids']:
             raise PLCInvalidArgument, "Not a member of the specified site"