Changeset 1435
- Timestamp:
- 11/21/08 05:36:21
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneGoogleSitemaps/branches/contenttype/browser/configure.zcml
r1434 r1435 15 15 /> 16 16 17 <browser:page 18 for="..interfaces.ISitemap" 19 name="mobile-sitemap.xml" 20 class=".mobilesitemapview.MobileSitemapView" 21 template="templates/mobilesitemapview.pt" 22 allowed_interface=".mobilesitemapview.IMobileSitemapView" 23 permission="zope.Public" 24 /> 17 25 18 26 </configure> qPloneGoogleSitemaps/branches/contenttype/browser/sitemapview.py
r1434 r1435 1 from string import find 2 from zope.interface import implements, Interface 1 from commonview import * 3 2 4 from Products.Five import BrowserView 5 from Products.CMFCore.utils import getToolByName 6 7 from Products.qPloneGoogleSitemaps import qPloneGoogleSitemapsMessageFactory as _ 8 from utils import additionalURLs, applyOperations 9 10 11 class ISitemapView(Interface): 12 """ 13 Sitemap view interface 14 """ 15 16 def test(): 17 """ test method""" 18 19 20 class SitemapView(BrowserView): 3 class SitemapView(CommonSitemapView): 21 4 """ 22 5 Sitemap browser view … … 24 7 implements(ISitemapView) 25 8 26 def __init__(self, context, request): 27 self.context = context 28 self.request = request 29 30 @property 31 def portal_catalog(self): 32 return getToolByName(self.context, 'portal_catalog') 33 34 @property 35 def portal(self): 36 return getToolByName(self.context, 'portal_url').getPortalObject() 37 38 def test(self): 39 """ 40 test method 41 """ 42 dummy = _(u'a dummy string') 43 44 return {'dummy': dummy} 45 46 def results(self, path=None): 47 if not path: 48 portal = getToolByName(self.context, 'portal_url') 49 path = portal.getPortalPath() 50 9 def getFilteredObjects(self): 10 path = self.portal.getPhysicalPath() 51 11 portal_types = self.context.getPortalTypes() 52 12 review_states = self.context.getStates() 53 catalog = getToolByName(self.context, 'portal_catalog') 54 try: 55 objects = catalog(path = path, 13 return self.portal_catalog(path = path, 56 14 portal_type = portal_types, 57 review_state = review_states,) 58 except AttributeError: 59 # We are run without being properly installed, do default processing 60 return applyOperations(catalog(path = path, 61 review_state = ['published'],), []) 15 review_state = review_states) 62 16 63 blackout_list = self.context.getBlackout_list() 64 reg_exps = self.context.getReg_exp() 65 return applyOperations([ob for ob in objects 66 if (ob.getId not in blackout_list)], 67 reg_exps) 68 69 def updateRequest(self): 70 self.request.RESPONSE.setHeader('Content-Type', 'text/xml') 71 try: 72 compression = self.context.enableHTTPCompression() 73 if compression: 74 compression(request=self.request) 75 except: 76 pass 77 78 def getAdditionalURLs(self): 79 return additionalURLs(self.context) 17 def getExceptionResults(self): 18 path = self.portal.getPhysicalPath() 19 return applyOperations( 20 self.portal_catalog(path = path, 21 review_state = ['published'],), 22 [])
