r100043 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100042‎ | r100043 | r100044 >
Date:15:59, 17 October 2011
Author:ariel
Status:deferred
Tags:
Comment:
remove stray raise; use relative web paths in generated html
Modified paths:
  • /branches/ariel/xmldumps-backup/WikiDump.py (modified) (history)
  • /branches/ariel/xmldumps-backup/worker.py (modified) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/WikiDump.py
@@ -95,7 +95,6 @@
9696 size = os.path.getsize(path)
9797 return (timestamp, size)
9898 except:
99 - raise
10099 return(None, None)
101100
102101 fileAge = staticmethod(fileAge)
@@ -429,6 +428,16 @@
430429
431430 def webDir(self):
432431 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
433442
434443 # Actions!
435444
Index: branches/ariel/xmldumps-backup/worker.py
@@ -897,6 +897,14 @@
898898 dateString = self._wiki.date
899899 return os.path.join(self._wiki.webDir(), dateString, dumpFile.filename)
900900
 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+
901909 def dirCacheOutdated(self, date):
902910 if not date:
903911 date = self._wiki.date
@@ -1375,8 +1383,8 @@
13761384 if itemStatus == "in-progress":
13771385 return "<li class='file'>%s %s (written) </li>" % (fileObj.filename, size)
13781386 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)
13811389 else:
13821390 return "<li class='missing'>%s</li>" % fileObj.filename
13831391
@@ -1423,7 +1431,7 @@
14241432 "status": self._reportStatusSummaryLine(done),
14251433 "previous": self._reportPreviousDump(done),
14261434 "items": html,
1427 - "checksum": self.dumpDir.webPath(f),
 1435+ "checksum": self.dumpDir.webPathRelative(f),
14281436 "index": self.wiki.config.index}
14291437
14301438 def _reportPreviousDump(self, done):

Status & tagging log