def testCanPublishPublicAndUnpublished(self): # (experiment public: True, access type: unpublished) -> False self.e1.public = True self.publish_data[self.access_type_key] = "unpublished" ph = PublishHandler(self.e1.id, create=True) ph.update(self.publish_data) self.assertTrue(self.provider.can_publish(self.e1))
def get_authors(self, experiment): phandler = PublishHandler(experiment.id) authors = phandler.custom_authors() if authors: return "* " + "\n* ".join(authors) else: return self.get_investigator_list(experiment)
def testCanPublishPublicAndPrivate(self): # (experiment public: True, access type: private) -> True self.e1.public = True self.publish_data[self.access_type_key] = "private" ph = PublishHandler(self.e1.id, create=True) ph.update(self.publish_data) self.assertTrue(self.provider.can_publish(self.e1))
def get_description(self, experiment): from tardis.apps.ands_register.publishing import PublishHandler phandler = PublishHandler(experiment.id) desc = phandler.custom_description() if not desc: desc = experiment.description return self.format_desc(desc)
def testCanPublishNoProject(self): self.e1.public = True self.e1.save() ph = PublishHandler(self.e1.id, create=True) ph.update(self.publish_data) self.assertTrue(self.provider.can_publish(self.e1)) self.p1.delete() self.assertFalse(self.provider.can_publish(self.e1))
def get_description(self, experiment): phandler = PublishHandler(experiment.id) desc = phandler.custom_description() if not desc: desc = experiment.description if self._is_html_formatted(desc): desc = html2text(desc) desc = desc.strip() return desc
def get_description(self, experiment): from tardis.apps.ands_register.publishing import PublishHandler phandler = PublishHandler(experiment.id) desc = phandler.custom_description() if not desc: # We do not want the abstract to be available in the description when # no custom description is available desc = "" return super(AnstoRifCsProvider, self).format_desc(desc)
def testGetDescriptionCustom(self): ph = PublishHandler(self.e1.id, create=True) self.publish_data[self.custom_description_key] = self.random_custom_description ph.update(self.publish_data) self.assertEquals(self.random_custom_description, ph.custom_description()) self.assertEquals(ph.custom_description(), self.random_custom_description) description = self.provider.get_description(self.e1) self.assertEquals(description, self.random_custom_description)
def get_description(self, experiment): phandler = PublishHandler(experiment.id) desc = phandler.custom_description() if not desc: desc = experiment.description return self.format_desc(desc)
def get_url(self, experiment, server_url): """Only public experiments can show the direct link to the experiment in the rif-cs""" phandler = PublishHandler(experiment.id) if experiment.public or (phandler.access_type() == publishing.PUBLIC): return "%s/experiment/view/%s/" % (server_url, experiment.id)
def can_publish(self, experiment): phandler = PublishHandler(experiment.id) return experiment.public or (phandler.access_type() is not publishing.UNPUBLISHED)
def _is_mediated(self, experiment): import tardis.apps.ands_register.publishing as publishing from tardis.apps.ands_register.publishing import PublishHandler phandler = PublishHandler(experiment.id) return phandler.access_type() == publishing.MEDIATED
def testCanPublishNotPublicAndMediated(self): # (experiment public: False, access type: mediated) -> FALSE self.publish_data[self.access_type_key] = "mediated" ph = PublishHandler(self.e1.id, create=True) ph.update(self.publish_data) self.assertFalse(self.provider.can_publish(self.e1))
def testCanPublishNotPublicAndPublic(self): # (experiment public: False, access type: public) -> FALSE ph = PublishHandler(self.e1.id, create=True) ph.update(self.publish_data) self.assertFalse(self.provider.can_publish(self.e1))
def can_publish(self, experiment): phandler = PublishHandler(experiment.id) if (not experiment.public) or (phandler.access_type() is publishing.UNPUBLISHED): return False return True
def testCanPublishPublicAndPublished(self): # (experiment public: True, access type: published) -> True self.e1.public = True ph = PublishHandler(self.e1.id, create=True) ph.update(self.publish_data) self.assertTrue(self.provider.can_publish(self.e1))