Fix typos and pep8

pull/74/head
Raphaël Vinot 2017-04-11 15:59:12 +02:00
parent bd7d782716
commit c74cdd19c6
1 changed files with 6 additions and 6 deletions

View File

@ -1245,7 +1245,7 @@ class PyMISP(object):
def get_organisations_list(self, scope="local"): def get_organisations_list(self, scope="local"):
session = self.__prepare_session() session = self.__prepare_session()
scope=scope.lower() scope = scope.lower()
if scope not in ["local", "external", "all"]: if scope not in ["local", "external", "all"]:
raise ValueError("Authorized fields are 'local','external' or 'all'") raise ValueError("Authorized fields are 'local','external' or 'all'")
url = urljoin(self.root_url, 'organisations/index/scope:{}'.format(scope)) url = urljoin(self.root_url, 'organisations/index/scope:{}'.format(scope))
@ -1261,8 +1261,8 @@ class PyMISP(object):
def add_organisation(self, name, **kwargs): def add_organisation(self, name, **kwargs):
new_org = self._set_organisation_parameters(**dict(name=name, **kwargs)) new_org = self._set_organisation_parameters(**dict(name=name, **kwargs))
session = self.__prepare_session() session = self.__prepare_session()
if local in new_org: if 'local' in new_org:
if new_org.get('local') == False: if new_org.get('local') is False:
if 'uuid' not in new_org: if 'uuid' not in new_org:
raise PyMISPError('A remote org MUST have a valid uuid') raise PyMISPError('A remote org MUST have a valid uuid')
url = urljoin(self.root_url, 'admin/organisations/add/') url = urljoin(self.root_url, 'admin/organisations/add/')
@ -1310,13 +1310,13 @@ class PyMISP(object):
if organisation is None: if organisation is None:
raise PyMISPError('Need a valid organisation as argument, create it before if needed') raise PyMISPError('Need a valid organisation as argument, create it before if needed')
if 'Organisation' in organisation: if 'Organisation' in organisation:
organisation=organisation.get('Organisation') organisation = organisation.get('Organisation')
if 'local' not in organisation: if 'local' not in organisation:
raise PyMISPError('Need a valid organisation as argument. "local" value have not been set in this organisation') raise PyMISPError('Need a valid organisation as argument. "local" value have not been set in this organisation')
if 'id' not in organisation: if 'id' not in organisation:
raise PyMISPError('Need a valid organisation as argument. "id" value doesn\'t exist in provided organisation') raise PyMISPError('Need a valid organisation as argument. "id" value doesn\'t exist in provided organisation')
# Local organisation is '0' and remote organisation is '1'. These values are extracted from web interface of MISP
if organisation.get('local') == True: if organisation.get('local'): # Local organisation is '0' and remote organisation is '1'. These values are extracted from web interface of MISP
organisation_type = 0 organisation_type = 0
else: else:
organisation_type = 1 organisation_type = 1