[Spambayes-checkins] website/scripts/ht2html LinkFixer.py, 1.1.1.1,
1.2
Mark Hammond
mhammond at users.sourceforge.net
Mon Oct 27 23:37:10 EST 2003
Update of /cvsroot/spambayes/website/scripts/ht2html
In directory sc8-pr-cvs1:/tmp/cvs-serv31686
Modified Files:
LinkFixer.py
Log Message:
The code that 'normalize the path, kind of the way os.path.normpath() does'
didn't do it quite like normpath did, so I replaced it with normpath <wink>
Its not clear what the problem was, but this works fine for all our
generation.
Index: LinkFixer.py
===================================================================
RCS file: /cvsroot/spambayes/website/scripts/ht2html/LinkFixer.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** LinkFixer.py 19 Sep 2002 08:40:55 -0000 1.1.1.1
--- LinkFixer.py 28 Oct 2003 04:37:08 -0000 1.2
***************
*** 41,52 ****
# normalize the path, kind of the way os.path.normpath() does.
# urlparse ought to have something like this...
! parts = []
! for p in absurl.split('/'):
! if p == '.':
! continue
! if p == '..' and len(parts) > 0:
! del parts[-1]
! parts.append(p)
! absurl = SLASH.join(parts)
self.msg('absurl= %s', absurl)
return absurl
--- 41,48 ----
# normalize the path, kind of the way os.path.normpath() does.
# urlparse ought to have something like this...
! # hrm - MarkH thinks this is broken, so it has been replaced
! # with normpath - what is the problem with normpath?
! import posixpath # use posix semantics for urls
! absurl = posixpath.normpath(absurl)
self.msg('absurl= %s', absurl)
return absurl
***************
*** 85,89 ****
links[i] = (url, '<b>' + text + '</b>', extra)
else:
! links[i] = (url, text, extra)
def above(self, absurl, myurl):
--- 81,85 ----
links[i] = (url, '<b>' + text + '</b>', extra)
else:
! links[i] = (absurl, text, extra)
def above(self, absurl, myurl):
More information about the Spambayes-checkins
mailing list