Esempio n. 1
0
    def create_tld(self, context, values):
        tld = models.Tld()
        tld.update(values)

        try:
            tld.save(self.session)
        except exceptions.Duplicate:
            raise exceptions.DuplicateTLD()

        return dict(tld)
Esempio n. 2
0
    def update_tld(self, context, tld_id, values):
        tld = self._find_tlds(context, {'id': tld_id}, one=True)
        tld.update(values)

        try:
            tld.save(self.session)
        except exceptions.Duplicate:
            raise exceptions.DuplicateTLD()

        return dict(tld)
Esempio n. 3
0
    def create_tld(self, context, tld):
        storage_tld = models.Tld()
        storage_tld.update(tld)

        try:
            storage_tld.save(self.session)
        except exceptions.Duplicate:
            raise exceptions.DuplicateTLD()

        return objects.Tld.from_sqla(storage_tld)