Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
plone.app.layout.sitemap.sitemap.SiteMapView Class Reference
Inheritance diagram for plone.app.layout.sitemap.sitemap.SiteMapView:
Inheritance graph
[legend]
Collaboration diagram for plone.app.layout.sitemap.sitemap.SiteMapView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def objects
def generate
def __call__

Public Attributes

 context
 request
 filename

Static Public Attributes

tuple template = ViewPageTemplateFile('sitemap.xml')

Detailed Description

Creates the sitemap as explained in the specifications.

http://www.sitemaps.org/protocol.php

Definition at line 16 of file sitemap.py.


Constructor & Destructor Documentation

def plone.app.layout.sitemap.sitemap.SiteMapView.__init__ (   self,
  context,
  request 
)

Definition at line 24 of file sitemap.py.

00024 
00025     def __init__(self, context, request):
00026         self.context = context
00027         self.request = request
00028         self.filename = 'sitemap.xml.gz'

Here is the caller graph for this function:


Member Function Documentation

Checks if the sitemap feature is enable and returns it.

Definition at line 52 of file sitemap.py.

00052 
00053     def __call__(self):
00054         """Checks if the sitemap feature is enable and returns it."""
00055         sp = getToolByName(self.context, 'portal_properties').site_properties
00056         if not sp.enable_sitemap:
00057             raise NotFound(self.context, self.filename, self.request)
00058 
00059         self.request.response.setHeader('Content-Type',
00060                                         'application/octet-stream')
00061         return self.generate()

Here is the call graph for this function:

Here is the caller graph for this function:

Generates the Gzipped sitemap.

Definition at line 41 of file sitemap.py.

00041 
00042     def generate(self):
00043         """Generates the Gzipped sitemap."""
00044         xml = self.template()
00045         fp = StringIO()
00046         gzip = GzipFile(self.filename, 'w', 9, fp)
00047         gzip.write(xml)
00048         gzip.close()
00049         data = fp.getvalue()
00050         fp.close()
00051         return data

Here is the caller graph for this function:

Returns the data to create the sitemap.

Definition at line 29 of file sitemap.py.

00029 
00030     def objects(self):
00031         """Returns the data to create the sitemap."""
00032         catalog = getToolByName(self.context, 'portal_catalog')
00033         for item in catalog.searchResults({'Language': 'all'}):
00034             yield {
00035                 'loc': item.getURL(),
00036                 'lastmod': item.modified.ISO8601(),
00037                 #'changefreq': 'always', # hourly/daily/weekly/monthly/yearly/never
00038                 #'prioriy': 0.5, # 0.0 to 1.0
00039             }

Here is the call graph for this function:


Member Data Documentation

Definition at line 25 of file sitemap.py.

Definition at line 27 of file sitemap.py.

Definition at line 26 of file sitemap.py.

tuple plone.app.layout.sitemap.sitemap.SiteMapView.template = ViewPageTemplateFile('sitemap.xml') [static]

Definition at line 22 of file sitemap.py.


The documentation for this class was generated from the following file: