Esempio n. 1
0
    def create_blacklist(self, context, values):
        blacklist = models.Blacklists()

        blacklist.update(values)

        try:
            blacklist.save(self.session)
        except exceptions.Duplicate:
            raise exceptions.DuplicateBlacklist()

        return dict(blacklist)
Esempio n. 2
0
    def create_blacklist(self, context, blacklist):
        storage_blacklist = models.Blacklists()

        storage_blacklist.update(blacklist)

        try:
            storage_blacklist.save(self.session)
        except exceptions.Duplicate:
            raise exceptions.DuplicateBlacklist()

        return objects.Blacklist.from_sqla(storage_blacklist)
Esempio n. 3
0
    def update_blacklist(self, context, blacklist_id, values):
        blacklist = self._find_blacklist(context, {'id': blacklist_id},
                                         one=True)

        blacklist.update(values)

        try:
            blacklist.save(self.session)
        except exceptions.Duplicate:
            raise exceptions.DuplicateBlacklist()

        return dict(blacklist)