Exemplo n.º 1
0
 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
Exemplo n.º 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
Exemplo n.º 3
0
Arquivo: core.py Projeto: lorin/cider
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)
Exemplo n.º 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)