def init_settings(): """ Init settings for the OAI-PMH feature. Set the name, identifier and the harvesting information """ try: #Get OAI-PMH settings information about this server information = OaiSettings.objects.all() #If we don't have settings in database, we have to initialize them if not information: OaiSettings(repositoryName = settings.OAI_NAME, repositoryIdentifier = settings.OAI_REPO_IDENTIFIER, enableHarvesting= False).save() except Exception, e: print('ERROR : Impossible to init the settings : ' + e.message)
def dump_oai_settings(self): self.assertEquals(len(OaiSettings.objects()), 0) self.restoreDump(join(DUMP_OAI_PMH_TEST_PATH, 'oai_settings.bson'), 'oai_settings') self.assertTrue(len(OaiSettings.objects()) > 0)
def dump_oai_settings_bad(self): self.assertEquals(len(OaiSettings.objects()), 0) self.restoreDump(join(DUMP_OAI_PMH_TEST_PATH, 'oai_settings_bad.bson'), 'oai_settings') self.assertTrue(len(OaiSettings.objects()) > 0)