Exemplo n.º 1
0
def sample_get_file_url(filename):
    user = api.current_user()
    if user:
        oid = api.oid_by_name(user, filename)
        if oid:
            return api.url_for(user, oid)
    return ''
Exemplo n.º 2
0
def sample_get_file_url(filename):
    user = api.current_user()
    if user:
        oid = api.oid_by_name(user, filename)
        if oid:
            return api.url_for(user, oid)
    return ''
Exemplo n.º 3
0
def link_to_file(key, oid):
    user = api.user_by_key(key)
    if not user:
        abort(404)
    url = api.url_for(user, oid)
    if url:
        return url
    abort(404)
Exemplo n.º 4
0
def link_to_file(key, oid):
    user = api.user_by_key(key)
    if not user:
        abort(404)
    url = api.url_for(user, oid)
    if url:
        return url
    abort(404)
Exemplo n.º 5
0
def sample_save_from_filesystem(filename):
    user = api.current_user()
    if user:
        try:
            fileHandle = api.File(filename)
            oid = api.save_file(user, fileHandle)
            return api.url_for(user, oid)
        except IOError:
            pass
    return ''
Exemplo n.º 6
0
def sample_save_from_filesystem(filename):
    user = api.current_user()
    if user:
        try:
            fileHandle = api.File(filename)
            oid = api.save_file(user, fileHandle)
            return api.url_for(user, oid)
        except IOError:
            pass
    return ''