Changeset 23
- Timestamp:
- 11/10/06 20:54:20 (5 years ago)
- File:
-
- 1 edited
-
sitemap-plugin/trunk/sitemap/api.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sitemap-plugin/trunk/sitemap/api.py
r19 r23 77 77 contributors = ExtensionPoint(ISitemapContributor) 78 78 79 confirmationpage = Option('sitemap', 'confirmationpage', '', 80 """Name of the Google Sitemaps confirmation page (e.g. googleeb3689b3689b3689.html).""") 81 79 82 path = '/sitemap.xml' 80 83 … … 102 105 def match_request(self, req): 103 106 """Return whether the handler wants to process the given request.""" 104 return req.path_info == self.path 107 return req.path_info == self.path or (len (self.confirmationpage) > 0 and req.path_info == self.confirmationpage) 105 108 106 109 def process_request(self, req): … … 108 111 simply send the response itself and not return anything. 109 112 """ 110 doc = Document() 111 urlset = doc.createElement("urlset") 112 a = doc.createAttribute('xmlns') 113 a.value = self.ns 114 urlset.setAttributeNode(a) 115 for c in self.contributors: 116 for ressource_data in c.get_data(req): 117 urlset.appendChild(ressource_data.to_node(doc)) 113 if req.path_info == self.confirmationpage: 114 req.send_response(200) 115 req.send_header('Content-Type', 'text/plain') 116 req.end_headers() 117 req.write('Hello Google!') 118 119 else: 120 doc = Document() 121 urlset = doc.createElement("urlset") 122 a = doc.createAttribute('xmlns') 123 a.value = self.ns 124 urlset.setAttributeNode(a) 125 for c in self.contributors: 126 for ressource_data in c.get_data(req): 127 urlset.appendChild(ressource_data.to_node(doc)) 118 128 119 doc.appendChild(urlset)120 req.send_response(200)121 req.send_header('Content-Type', 'text/xml;charset=UTF-8')122 req.end_headers()129 doc.appendChild(urlset) 130 req.send_response(200) 131 req.send_header('Content-Type', 'text/xml;charset=UTF-8') 132 req.end_headers() 123 133 124 req.write(doc.toxml('UTF-8'))134 req.write(doc.toxml('UTF-8')) 125 135 126 136 def send_ping(self):
Note: See TracChangeset
for help on using the changeset viewer.
