Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 1332:e2d51ba4f6b1
key the templates cache off full path, not filename
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 11 Dec 2002 11:37:07 +0000 |
| parents | 2e5a9fc7abd5 |
| children | 6a54b51b1784 |
comparison
equal
deleted
inserted
replaced
| 1331:3b953be32cdc | 1332:e2d51ba4f6b1 |
|---|---|
| 82 raise NoTemplate, 'No template file exists for templating '\ | 82 raise NoTemplate, 'No template file exists for templating '\ |
| 83 '"%s" with template "%s" (neither "%s" nor "%s")'%(name, | 83 '"%s" with template "%s" (neither "%s" nor "%s")'%(name, |
| 84 extension, filename, generic) | 84 extension, filename, generic) |
| 85 filename = generic | 85 filename = generic |
| 86 | 86 |
| 87 if self.templates.has_key(filename) and \ | 87 if self.templates.has_key(src) and \ |
| 88 stime < self.templates[filename].mtime: | 88 stime < self.templates[src].mtime: |
| 89 # compiled template is up to date | 89 # compiled template is up to date |
| 90 return self.templates[filename] | 90 return self.templates[src] |
| 91 | 91 |
| 92 # compile the template | 92 # compile the template |
| 93 self.templates[filename] = pt = RoundupPageTemplate() | 93 self.templates[src] = pt = RoundupPageTemplate() |
| 94 pt.write(open(src).read()) | 94 pt.write(open(src).read()) |
| 95 pt.id = filename | 95 pt.id = filename |
| 96 pt.mtime = time.time() | 96 pt.mtime = time.time() |
| 97 return pt | 97 return pt |
| 98 | 98 |
