def test_disabled(self): ''' If the sitemap is disabled throws a 404 error. ''' self.site_settings.enable_sitemap = False try: self.sitemap() except Exception, e: # zope2 and repoze.zope2 use different publishers and raise # different exceptions. but both implement INotFound. self.assertTrue(INotFound.providedBy(e))
def test_disabled(self): ''' If the sitemap is disabled throws a 404 error. ''' self.site_properties.manage_changeProperties(enable_sitemap=False) try: self.sitemap() except Exception, e: # zope2 and repoze.zope2 use different publishers and raise # different exceptions. but both implement INotFound. self.assertTrue(INotFound.providedBy(e))
def test_disabled(self): """ If the sitemap is disabled throws a 404 error. """ self.site_settings.enable_sitemap = False try: self.sitemap() except Exception, e: # zope2 and repoze.zope2 use different publishers and raise # different exceptions. but both implement INotFound. self.assertTrue(INotFound.providedBy(e))
def test_disabled(self): ''' If the sitemap is disabled throws a 404 error. ''' self.site_settings.enable_sitemap = False try: self.sitemap() except Exception as e: # zope2 and repoze.zope2 use different publishers and raise # different exceptions. but both implement INotFound. self.assertTrue(INotFound.providedBy(e)) else: self.fail('The disabled sitemap view has to raise NotFound!')
def test_disabled(self): """ If the keyword map sitemap is disabled throws a 404 error. """ from zope.publisher.interfaces import INotFound from redomino.advancedkeyword.browser.keywordmapcontrolpanel import IKeywordMapSchema IKeywordMapSchema(self.portal).keywordmapenabled = False self.assertFalse('Subjects map' in self.portal()) try: self.sitemap() except Exception, e: # zope2 and repoze.zope2 use different publishers and raise # different exceptions. but both implement INotFound. self.assertTrue(INotFound.providedBy(e))
def crumbs(self): objects = [] for obj in ( [self.context] + list(zope.traversing.api.getParents(self.context)) ): if INotFound.providedBy(obj): obj = obj.getObject() objects.append(obj) if ISite.providedBy(obj): break objects.reverse() for object in objects: info = zope.component.getMultiAdapter((object, self.request), IBreadcrumb) yield {'name': info.name, 'url': info.url, 'activeURL': info.activeURL}