Index: branches/ariel/xmldumps-backup/WikiDump.py |
— | — | @@ -95,7 +95,6 @@ |
96 | 96 | size = os.path.getsize(path) |
97 | 97 | return (timestamp, size) |
98 | 98 | except: |
99 | | - raise |
100 | 99 | return(None, None) |
101 | 100 | |
102 | 101 | fileAge = staticmethod(fileAge) |
— | — | @@ -429,6 +428,16 @@ |
430 | 429 | |
431 | 430 | def webDir(self): |
432 | 431 | return "/".join((self.config.webRoot, self.dbName)) |
| 432 | + |
| 433 | + def webDirRelative(self): |
| 434 | + webRootRelative = self.webDir() |
| 435 | + i = webRootRelative.find("://") |
| 436 | + if i >= 0: |
| 437 | + webRootRelative = webRootRelative[i:] |
| 438 | + i = webRootRelative.find("/") |
| 439 | + if i >= 0: |
| 440 | + webRootRelative = webRootRelative[i:] |
| 441 | + return webRootRelative |
433 | 442 | |
434 | 443 | # Actions! |
435 | 444 | |
Index: branches/ariel/xmldumps-backup/worker.py |
— | — | @@ -897,6 +897,14 @@ |
898 | 898 | dateString = self._wiki.date |
899 | 899 | return os.path.join(self._wiki.webDir(), dateString, dumpFile.filename) |
900 | 900 | |
| 901 | + |
| 902 | + def webPathRelative(self, dumpFile, dateString = None): |
| 903 | + """Given a DumpFilename object produce the url relative to the docroot for the filename for the date of |
| 904 | + the dump for the selected database.""" |
| 905 | + if (not dateString): |
| 906 | + dateString = self._wiki.date |
| 907 | + return os.path.join(self._wiki.webDirRelative(), dateString, dumpFile.filename) |
| 908 | + |
901 | 909 | def dirCacheOutdated(self, date): |
902 | 910 | if not date: |
903 | 911 | date = self._wiki.date |
— | — | @@ -1375,8 +1383,8 @@ |
1376 | 1384 | if itemStatus == "in-progress": |
1377 | 1385 | return "<li class='file'>%s %s (written) </li>" % (fileObj.filename, size) |
1378 | 1386 | elif itemStatus == "done": |
1379 | | - webpath = self.dumpDir.webPath(fileObj) |
1380 | | - return "<li class='file'><a href=\"%s\">%s</a> %s</li>" % (webpath, fileObj.filename, size) |
| 1387 | + webpathRelative = self.dumpDir.webPathRelative(fileObj) |
| 1388 | + return "<li class='file'><a href=\"%s\">%s</a> %s</li>" % (webpathRelative, fileObj.filename, size) |
1381 | 1389 | else: |
1382 | 1390 | return "<li class='missing'>%s</li>" % fileObj.filename |
1383 | 1391 | |
— | — | @@ -1423,7 +1431,7 @@ |
1424 | 1432 | "status": self._reportStatusSummaryLine(done), |
1425 | 1433 | "previous": self._reportPreviousDump(done), |
1426 | 1434 | "items": html, |
1427 | | - "checksum": self.dumpDir.webPath(f), |
| 1435 | + "checksum": self.dumpDir.webPathRelative(f), |
1428 | 1436 | "index": self.wiki.config.index} |
1429 | 1437 | |
1430 | 1438 | def _reportPreviousDump(self, done): |