Beispiel #1
0
 def POST(self):
     form = bookmark_form()
     if not form.validates():
         content = 'Validation error'
         return render.add_bookmark(content, form)
     else:
         i = web.input()
         #db = web.database(dbn='sqlite', db='bookmarks_webpy.sqlite')
         bookmark = Bookmark(db)
         bookmark.url = i.url
         bookmark.description = i.description
         bookmark.author = session.user_id
         result = bookmark.save()
         content = 'bookmark added'
         return render.add_bookmark_success(content, result)
Beispiel #2
0
 def GET(self):
     form = bookmark_form()
     content = 'Add bookmark'
     return render.add_bookmark(content, form)