152 handler.endElement(u"td") |
152 handler.endElement(u"td") |
153 handler.startElement(u"td", {}) |
153 handler.startElement(u"td", {}) |
154 handler.characters(u"%i%sKB" % (size / 1024, unichr(160))) |
154 handler.characters(u"%i%sKB" % (size / 1024, unichr(160))) |
155 handler.endElement(u"td") |
155 handler.endElement(u"td") |
156 |
156 |
157 def mirror(self, handler, prefix, title): |
157 def mirror(self, handler, prefix, title, stripprefix = u""): |
158 |
158 |
159 """<?mirror prefix="..." title="..."?> - generates a mirror switch link, |
159 """<?mirror prefix="..." title="..." [stripprefix="..."] ?> - generates a mirror switch link, |
160 where prefix denotes the base root url of the mirror location |
160 where prefix denotes the base root url of the mirror location |
161 and title the visible description""" |
161 and title the visible description""" |
162 |
162 |
163 stripprefix = args.get(u"stripprefix", u"") |
|
164 thisloc = self._pc.relLocOfThis() |
163 thisloc = self._pc.relLocOfThis() |
165 if thisloc.startswith(stripprefix): |
164 if thisloc.startswith(stripprefix): |
166 thisloc = thisloc[len(stripprefix):] |
165 thisloc = thisloc[len(stripprefix):] |
167 else: |
166 else: |
168 raise Exception("Incompatible mirror (prefix to strip not found): %s" % title.encode("latin-1")) |
167 raise Exception("Incompatible mirror (prefix to strip not found): %s" % title.encode("latin-1")) |