def is_url(self, string):
     """
     Test if a pdf being submitted is a valid URL
     """
     try:
         urlparse(string, rule="IRI")
         return True
     except:
         return False
Beispiel #2
0
 def is_url(self, string):
     """
     Test if a pdf being submitted is a valid URL
     """
     try:
         urlparse(string, rule="IRI")
         return True
     except Exception:
         return False
Beispiel #3
0
def _apply_icon(app, icon):
    app_path = osx.path_for_app(app)
    if not app_path:
        raise AppMissingError("Application not found: '{0}'".format(app))

    try:
        components = urlparse(icon)
        tmpdir = mkdtemp()
        icon_path = os.path.join(tmpdir, os.path.basename(components["path"]))
        print(tty.progress("Downloading {0} icon: {1}".format(app, icon)))
        curl(icon, icon_path)
    except ValueError:
        icon_path = icon

    osx.set_icon(app_path, icon_path)
Beispiel #4
0
def _apply_icon(app, icon):
    app_path = osx.path_for_app(app)
    if not app_path:
        raise AppMissingError("Application not found: '{0}'".format(app))

    try:
        components = urlparse(icon)
        tmpdir = mkdtemp()
        icon_path = os.path.join(tmpdir, os.path.basename(components["path"]))
        print(tty.progress("Downloading {0} icon: {1}".format(app, icon)))
        curl(icon, icon_path)
    except ValueError:
        icon_path = icon

    osx.set_icon(app_path, icon_path)