def transfer_domain(self, domain, user, user_id, password, nameservers=None, reg_domain=None, extras=None): try: attrs = self._make_domain_transfer_attrs(domain, user, user_id, password, nameservers, reg_domain) if extras: attrs.update(extras) rsp = self._sw_register_domain(attrs) order_id = rsp.get_data()['attributes']['id'] return { 'domain_name': domain, 'registrar_data': { 'ref_number': order_id }, } except errors.XCPError as e: if e.response_code == self.CODE_DOMAIN_NOT_TRANSFERABLE: raise errors.DomainNotTransferable(e) if e.response_code == self.CODE_DOMAIN_REGISTRATION_FAILED: if (e.response_text.startswith('Invalid domain syntax') or e.response_text.startswith( 'Invalid syntax on domain')): raise errors.InvalidDomain(e) raise errors.DomainTransferFailure(e) raise
def _capture(self, *args, **kwargs): try: return fn(self, *args, **kwargs) except errors.XCPError as e: if e.response_code == self.CODE_DOMAIN_NOT_TRANSFERABLE: raise errors.DomainNotTransferable(e) if e.response_code == self.CODE_DOMAIN_REGISTRATION_FAILED: if (e.response_text.startswith('Invalid domain syntax') or e.response_text.startswith( 'Invalid syntax on domain')): raise errors.InvalidDomain(e) raise errors.DomainTransferFailure(e) raise