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
unfollow.py · 535 bytes · 18 lines
1from dbbasic.tsv import TSV
2from dbbasic_web.responses import redirect
3from dbbasic_accounts import Accounts
4
5accounts = Accounts('.', domain='localhost')
6follows = TSV("follows", ["follower", "following", "created"])
7
8def handle(request):
9 username = request.path_param(1)
10 if not username:
11 return redirect('/')
12
13 user, auth_error = request.require_auth(accounts)
14 if auth_error:
15 return auth_error
16
17 follows.delete(follower=user.username, following=username)
18 return redirect(f'/profile/{username}')