Attachment 'wiki-colon-link-hackyfix1.diff'

Download

   1 --- web/request.py.orig	2010-09-21 18:23:31.000000000 +1000
   2 +++ web/request.py	2010-09-21 18:24:16.000000000 +1000
   3 @@ -61,7 +61,25 @@
   4      def __init__(self, environ, populate_request=True, shallow=False):
   5          ResponseBase.__init__(self)
   6          RequestBase.__init__(self, environ, populate_request, shallow)
   7 -        self.href = Href(self.script_root or '/', self.charset)
   8 +
   9 +        # Originally:
  10 +        #self.href = Href(self.script_root or '/', self.charset)
  11 +
  12 +        # But that breaks on pages with a name such as "Titanic: The Comeback"
  13 +        # as the : is not escaped and the : is interpreted as a protocol
  14 +        # method. Fix this here by prepending a ./ to any generated hrefs that
  15 +        # don't look like URLs.
  16 +        self._href = Href(self.script_root or '/', self.charset)
  17 +        def page_href(*args, **kwargs):
  18 +            url = args[0]
  19 +            if ':' in url and url[0] != '/':
  20 +                method, _ = url.split(':', 1)
  21 +                if method not in ('http', 'https', 'ftp', 'mailto'):
  22 +                    url = './' + args[0]
  23 +                    args = (url,) + args[1:]
  24 +            return self._href(*args, **kwargs)
  25 +        self.href = page_href
  26 +
  27          self.abs_href = Href(self.url_root, self.charset)
  28          self.headers = Headers([('Content-Type', 'text/html')])
  29          self.response = []

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-10-14 03:45:53, 1.3 KB) [[attachment:wiki-colon-link-hackyfix1.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.