Example DBBasic apps (an API, a blog and a microblog) and a template for new DBBasic modules.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-examples.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-examples.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-examples.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add official module template for creating DBBasic packages 17cf88a 1 year, 1 month ago History
new.py · 639 bytes · 20 lines
1from dbbasic.tsv import TSV
2from dbbasic_web.responses import html, redirect
3from dbbasic_web.templating import render
4import time
5
6posts = TSV("posts", ["id", "title", "content", "author", "created"])
7
8def handle(request):
9 if request.method == 'POST':
10 post_id = str(int(time.time() * 1000))
11 posts.insert({
12 'id': post_id,
13 'title': request.param('title', ''),
14 'content': request.param('content', ''),
15 'author': request.param('author', ''),
16 'created': time.strftime('%Y-%m-%d %H:%M')
17 })
18 return redirect('/')
19
20 return html(render('new.html'))