示例#1
0
def writesomething(parentchunkid = 0):
    if parentchunkid == 0:
        print('title required')
        requiretitle = True
    else:
        print('no title req')
        requiretitle = False
    if session['userid']:
        return render_template('writesomething.html', parent=api.read_chunk(parentchunkid), requiretitle=requiretitle)
    else:
        return redirect('/login/signinbeforewriting')
示例#2
0
def storyviewer(chunkid = 0):

    if chunkid == 0:
        # show the list of potential story chunks
        firstchapters = api.get_index()
        return flask.render_template('browse_sv.html', index = firstchapters)

    
    
    chunks = []
    # climb the parent tree.  I want to preserve each chunk as an object.
    
    lastchunk = api.read_chunk(chunkid)
    chunks.append(lastchunk)
    
    while lastchunk.parent:
        newchunk = api.read_chunk(lastchunk.parent)
        chunks.append(newchunk)
        lastchunk = newchunk
        
    # flip the array
    chunks.reverse()
    return flask.render_template('storyviewer.html', chunks=chunks)
示例#3
0
def readsomething(chunkid):
    chunk = api.read_chunk(chunkid)
    print(chunk.text)
    return render_template('readsomething.html', chunk=chunk)