~nskaggs/help-app/functional-test-template

« back to all changes in this revision

Viewing changes to internals/translations/utils.py

  • Committer: Daniel Holbach
  • Date: 2015-04-08 12:34:32 UTC
  • mto: This revision was merged to the branch mainline in revision 135.
  • Revision ID: daniel.holbach@canonical.com-20150408123432-a5ctzpsv95pcponz
split out link checking functionality into utils.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
import sys
3
3
import tempfile
 
4
import urllib.parse
4
5
 
5
6
 
6
7
def require(package):
37
38
]
38
39
 
39
40
 
 
41
def link_is_anchor(link):
 
42
    return link.startswith('#')
 
43
 
 
44
 
 
45
def link_is_local(link):
 
46
    url = urllib.parse.urlparse(link)
 
47
    return url.netloc in [None, '', 'localhost']
 
48
 
 
49
 
40
50
def normalise_path(path):
41
51
    return os.path.relpath(path, TOP_LEVEL_DIR)
42
52