Changeset 130:618943a87b70

Show
Ignore:
Timestamp:
2007-08-03 04:02:41 (1 year ago)
Author:
Stefan Schwarzer <sschwarzer@sschwarzer.net>
branch:
default
Message:
Limit `replace` to change only one occurence of the document root.
This helps in the unprobable situation where the string representing
the root occurs a second time in the path.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • converter.py

    r127 r130  
    135135            html_parts.append(u'&nbsp;%s&nbsp;&nbsp;' % arg) 
    136136        else: 
    137             old_url = path.replace(config.root, "") or "/" 
     137            old_url = path.replace(config.root, "", 1) or "/" 
    138138            old_url = urllib.quote(old_url) 
    139139            html_parts.append( 
  • websourcebrowser.py

    r129 r130  
    201201                    html = converter.text_to_html(text, path) 
    202202            # assume title is UTF-8-encoded though we don't know for sure 
    203             title = coding.decode(path).replace(config.root+os.sep, "") or u"." 
     203            title = coding.decode(path).replace( 
     204                    config.root+os.sep, "",1) or u"." 
    204205            self.emit_data(html, title=title, mtime=os.path.getmtime(path)) 
    205206