@classmethod<EOL><INDENT>def from_urlpath(cls, path, app=None):<DEDENT>
app = app or current_app<EOL>base = app.config['<STR_LIT>']<EOL>path = urlpath_to_abspath(path, base)<EOL>if not cls.generic:<EOL><INDENT>kls = cls<EOL><DEDENT>elif os.path.isdir(path):<EOL><INDENT>kls = cls.directory_class<EOL><DEDENT>else:<EOL><INDENT>kls = cls.file_class<EOL><DEDENT>return kls(path=path, app=app)<EOL>
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