def test_indexation_disabled(self): fi = self.createFile('test.pdf') gsettings = GlobalSettings(self.portal) # indexation is enabled by default, so disable it gsettings.enable_indexation = False notify(ObjectInitializedEvent(fi)) # make sure conversion was successfull self.failUnless(self._isSuccessfullyConverted(fi)) annotations = IAnnotations(fi)['collective.documentviewer'] self.failUnless(annotations['catalog'] is None)
def test_indexation_disabled(self): gsettings = GlobalSettings(self.portal) # indexation is enabled by default, so disable it gsettings.enable_indexation = False fi = self.createFile('test.pdf') # make sure conversion was successfull self.assertTrue(self._isSuccessfullyConverted(fi)) annotations = IAnnotations(fi)['collective.documentviewer'] self.assertTrue(annotations['catalog'] is None)
def test_indexation_disabled(self): fi = self.createFile('test.pdf') gsettings = GlobalSettings(self.portal) # indexation is enabled by default, so disable it gsettings.enable_indexation = False notify(ObjectInitializedEvent(fi)) # make sure conversion was successfull self.failUnless(self._isSuccessfullyConverted(fi)) annotations = IAnnotations(fi)['collective.documentviewer'] self.failUnless(annotations['catalog'] is None)
def configure(context): """ """ if context.readDataFile('ploneintranet.docconv_default.txt') is None: return log.info("document conversion configuration") global_settings = GlobalSettings(getSite()) global_settings.enable_indexation = False global_settings.auto_select_layout = False global_settings.auto_layout_file_types = CONVERTABLE_TYPES.keys() commit() log.info("document conversion configuration: done.")
def test_indexation_switch_mode(self): ''' Test that switching the indexation from enabled to disabled and the other way round keep the state consistent. ''' fi = self.createFile('test.pdf') # indexation is enabled by default # make sure conversion was successfull self.failUnless(self._isSuccessfullyConverted(fi)) annotations = IAnnotations(fi)['collective.documentviewer'] # something is catalogued self.failUnless(annotations['catalog'] is not None) # now disable indexation and convert again gsettings = GlobalSettings(self.portal) gsettings.enable_indexation = False # make it convertable again by adapting last_updated and filehash annotations['last_updated'] = DateTime('1901/01/01').ISO8601() annotations['filehash'] = 'dummymd5' notify(ObjectInitializedEvent(fi)) # make sure conversion was successfull self.failUnless(self._isSuccessfullyConverted(fi)) # nothing indexed anymore self.failIf(annotations['catalog'] is not None)
def test_indexation_switch_mode(self): ''' Test that switching the indexation from enabled to disabled and the other way round keep the state consistent. ''' fi = self.createFile('test.pdf') # indexation is enabled by default notify(ObjectInitializedEvent(fi)) # make sure conversion was successfull self.failUnless(self._isSuccessfullyConverted(fi)) annotations = IAnnotations(fi)['collective.documentviewer'] # something is catalogued self.failUnless(annotations['catalog'] is not None) # now disable indexation and convert again gsettings = GlobalSettings(self.portal) gsettings.enable_indexation = False # make it convertable again by adapting last_updated and filehash annotations['last_updated'] = DateTime('1901/01/01').ISO8601() annotations['filehash'] = 'dummymd5' notify(ObjectInitializedEvent(fi)) # make sure conversion was successfull self.failUnless(self._isSuccessfullyConverted(fi)) # nothing indexed anymore self.failIf(annotations['catalog'] is not None)