Exemplo n.º 1
0
    def fetch_all_groups():
        """Pull all group names and ids from Elvanto."""
        data = elvanto("groups/getAll")
        if data['status'] != 'ok':
            raise ElvantoException

        for grp in data['groups']['group']:
            grp_obj = ElvantoGroup.objects.get_or_create(e_id=grp['id'])[0]
            grp_obj.name = grp['name']
            grp_obj.save()
Exemplo n.º 2
0
    def fetch_all_groups():
        """Pull all group names and ids from Elvanto."""
        data = elvanto("groups/getAll")
        if data['status'] != 'ok':
            raise ElvantoException

        for grp in data['groups']['group']:
            grp_obj = ElvantoGroup.objects.get_or_create(e_id=grp['id'])[0]
            grp_obj.name = grp['name']
            grp_obj.save()
Exemplo n.º 3
0
    def fetch_all_groups():
        """Pull all group names and ids from Elvanto."""
        data = elvanto("groups/getAll")
        if data["status"] != "ok":
            raise ElvantoException

        for grp in data["groups"]["group"]:
            grp_obj = ElvantoGroup.objects.get_or_create(e_id=grp["id"])[0]
            grp_obj.name = grp["name"]
            grp_obj.save()
Exemplo n.º 4
0
    def pull(self):
        """Pull group from Elvanto into related apostello group."""
        apostello_group = self.create_apostello_group()
        data = elvanto("groups/getInfo", id=self.e_id, fields=['people'])
        if data['status'] != 'ok':
            raise ElvantoException

        if data['group'][0]['people']:
            for prsn in data['group'][0]['people']['person']:
                ElvantoGroup.add_person(apostello_group, prsn)

        apostello_group.save()
        self.last_synced = timezone.now()
        self.save()
Exemplo n.º 5
0
    def pull(self):
        """Pull group from Elvanto into related apostello group."""
        apostello_group = self.create_apostello_group()
        data = elvanto("groups/getInfo", id=self.e_id, fields=['people'])
        if data['status'] != 'ok':
            raise ElvantoException

        if data['group'][0]['people']:
            for prsn in data['group'][0]['people']['person']:
                ElvantoGroup.add_person(apostello_group, prsn)

        apostello_group.save()
        self.last_synced = timezone.now()
        self.save()