Show
Ignore:
Timestamp:
2007-08-26 19:27:44 (1 year ago)
Author:
Stefan Schwarzer <sschwarzer@sschwarzer.net>
branch:
default
Message:
Changed implementation to generate an anchor from an URL path and put
it into module `tools.py`.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools.py

    r291 r294  
    2121# SOFTWARE. 
    2222 
     23import md5 
    2324import os 
    2425import re 
     
    4142    return os.path.abspath(path) 
    4243 
     44def url_to_anchor(url): 
     45    """ 
     46    Return a string, specific for the URL `url`, which is usable as an 
     47    anchor in HTML links. 
     48    """ 
     49    # this implementation has a _very_ small chance to reuse the same 
     50    #  anchor for different URLs 
     51    return md5.new(url).hexdigest()[:10] 
     52