def init_deposit(self, paper, user): """ Refuse deposit when the paper is already on Zenodo """ super(ZenodoProtocol, self).init_deposit(paper, user) for r in paper.oairecords: domain = extract_domain(r.splash_url) if domain.endswith('zenodo.org'): return False return True
def init_deposit(self, paper, user): """ Refuse deposit when the paper is already on OSF. """ super(OSFProtocol, self).init_deposit(paper, user) for r in paper.oairecords: domain = extract_domain(r.splash_url) or '' if domain.endswith('osf.io'): return False return (True)
def init_deposit(self, paper, user): """ Refuse deposit when the paper is already on Zenodo """ super(ZenodoProtocol, self).init_deposit(paper, user) for r in paper.oairecords: domain = extract_domain(r.splash_url) or '' if domain.endswith('zenodo.org'): return False return True
def init_deposit(self, paper, user): """ We reject in advance papers that are already in HAL """ super(HALProtocol, self).init_deposit(paper,user) for r in paper.oairecords: domain = extract_domain(r.splash_url) or '' if ('oai:HAL:' in r.identifier or domain.endswith('archives-ouvertes.fr')): return False self.hal_preferences = self.get_preferences(user) return True
def init_deposit(self, paper, user): """ We reject in advance papers that are already in HAL """ super(HALProtocol, self).init_deposit(paper, user) for r in paper.oairecords: domain = extract_domain(r.splash_url) or '' if ('oai:HAL:' in r.identifier or domain.endswith('archives-ouvertes.fr')): return False self.hal_preferences = self.get_preferences(user) return True
def domain(url): domain = extract_domain(url) if domain: return mark_safe(escape(domain)) else: return mark_safe('')
def test_extract_domain(self): self.assertEqual(extract_domain('https://gnu.org/test.html'), 'gnu.org') self.assertTrue(extract_domain('nonsense') is None)