base.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mist.api 作者: mistio 项目源码 文件源码
def create_zone(self, zone, **kwargs):
        """
        This is the public method that is called to create a new DNS zone.
        """
        self._create_zone__prepare_args(kwargs)
        pr_zone = self._create_zone__for_cloud(**kwargs)
        # Set fields to cloud model and perform early validation.
        zone.zone_id = pr_zone.id
        zone.domain = pr_zone.domain
        zone.type = pr_zone.type
        zone.ttl = pr_zone.ttl
        zone.extra = pr_zone.extra
        # Attempt to save.
        try:
            zone.save()
        except me.ValidationError as exc:
            log.error("Error updating %s: %s", zone, exc.to_dict())
            raise BadRequestError({'msg': exc.message,
                                   'errors': exc.to_dict()})
        except me.NotUniqueError as exc:
            log.error("Zone %s not unique error: %s", zone, exc)
            raise ZoneExistsError()
        self.cloud.owner.mapper.update(zone)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号