code: def from_urlpath(cls, path, app=None):
          '''
          Alternative constructor which accepts a path as taken from URL and uses
          the given app or the current app config to get the real path.
  
          If class has attribute `generic` set to True, `directory_class` or
          `file_class` will be used as type.
  
          :param path: relative path as from URL
          :param app: optional, flask application
          :return: file object pointing to path
          :rtype: File
          '''
          app = app or current_app
          base = app.config['directory_base']
          path = urlpath_to_abspath(path, base)
          if not cls.generic:
              kls = cls
          elif os.path.isdir(path):
              kls = cls.directory_class
          else:
              kls = cls.file_class
          return kls(path=path, app=appf from_urlpath(cls, path, app=None):
          '''
          Alternative constructor which accepts a path as taken from URL and uses
          the given app or the current app config to get the real path.
  
          If class has attribute `generic` set to True, `directory_class` or
          `file_class` will be used as type.
  
          :param path: relative path as from URL
          :param app: optional, flask application
          :return: file object pointing to path
          :rtype: File
          '''
          app = app or current_app
          base = app.config['directory_base']
          path = urlpath_to_abspath(path, base)
          if not cls.generic:
              kls = cls
          elif os.path.isdir(path):
              kls = cls.directory_class
          else:
              kls = cls.file_class
          return kls(path=path, app=app)
docs: Alternative constructor which accepts a path as taken from URL and uses
          the given app or the current app config to get the real path.
  
          If class has attribute `generic` set to True, `directory_class` or
          `file_class` will be used as type.
  
          :param path: relative path as from URL
          :param app: optional, flask application
          :return: file object pointing to path
          :rtype: File