Changeset 7128
- Timestamp:
- 05/09/08 16:29:07 (8 months ago)
- Files:
-
- trunk/openlayers/tools/exampleparser.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/tools/exampleparser.py
r7127 r7128 5 5 import re 6 6 import urllib2 7 import time 7 8 from xml.dom.minidom import Document 8 9 … … 87 88 feed = doc.createElementNS("http://www.w3.org/2005/Atom", "feed") 88 89 for example in examples: 90 s = os.stat("../examples/" + example["example"]) 91 example["modified"] = s.st_mtime 92 93 examples.sort(key=lambda x:x["modified"]) 94 for example in sorted(examples, key=lambda x:x["modified"], reverse=True): 89 95 entry = doc.createElementNS("http://www.w3.org/2005/Atom", "entry") 90 96 … … 100 106 summary.appendChild(doc.createTextNode(example["shortdesc"] or example["example"])) 101 107 entry.appendChild(summary) 108 109 updated = doc.createElementNS("http://www.w3.org/2005/Atom", "updated") 110 updated.appendChild(doc.createTextNode( 111 time.strftime("%Y-%m-%dT%I:%M:%SZ",time.gmtime(example["modified"])))) 112 entry.appendChild(updated) 102 113 103 114 feed.appendChild(entry) … … 183 194 atom = open('../examples/example-list.xml','w') 184 195 doc = createFeed(exampleList) 185 atom.write(doc.to prettyxml(" "))196 atom.write(doc.toxml()) 186 197 atom.close() 187 198
