Exemplo n.º 1
0
    def POST(self, _id):
        if len(_id) != 24:
            raise web.notfound()
        from brave.notes.core.session import session
        form = self.form()
        error = ""
        if form.validates():
            body = form['body'].value

            c = Category.objects.GetNoteCategory(_id, session.user)
            c[0].notes[c[1]].text = body
            c[0].save()
            raise web.seeother(settings['path'] + '/notes/view/' + _id, absolute=True)
        else:
            for k in form.inputs:
                if k.note != None:
                    error = k.note
                    break

        return render.editnote(Category.objects.GetCategories(session.user), Category.objects.GetNote(_id, session.user), error)
Exemplo n.º 2
0
    def POST(self):
        from brave.notes.core.session import session
        form = self.form()
        error = ""
        if form.validates():
            _id = form['id'].value
            if len(_id) != 24:
                raise web.notfound()

            c = Category.objects.GetNoteCategory(_id, session.user)
            c[0].notes.pop(c[1])
            c[0].save()
            raise web.seeother(settings['path'] + '/notes', absolute=True)
        else:
            for k in form.inputs:
                if k.note != None:
                    error = k.note
                    break

        return render.editnote(Category.objects.GetCategories(session.user), Category.objects.GetNote(_id, session.user), error)
Exemplo n.º 3
0
    def GET(self, _id):
        if len(_id) != 24:
            raise web.notfound()
        from brave.notes.core.session import session

        return render.editnote(Category.objects.GetCategories(session.user), Category.objects.GetNote(_id, session.user), "")