Compare commits
4 Commits
fef9f0f1c2
...
08d9de8784
Author | SHA1 | Date | |
---|---|---|---|
08d9de8784 | |||
4a0d12971b | |||
95720ce0db | |||
9b50602873 |
0
data/g/.gitkeep
Normal file
0
data/g/.gitkeep
Normal file
|
@ -5,7 +5,7 @@ Guest Book
|
||||||
==========
|
==========
|
||||||
|
|
||||||
If you visited my website, please sign my guestbook!
|
If you visited my website, please sign my guestbook!
|
||||||
<form action="g/submit" method="POST" accept-charset="UTF-8">
|
<form action="submit" method="POST" accept-charset="UTF-8">
|
||||||
Your name:
|
Your name:
|
||||||
<input name="name">
|
<input name="name">
|
||||||
|
|
|
@ -40,7 +40,7 @@ async def new_message(event):
|
||||||
|
|
||||||
entry += '\n\n{}\n\n'.format(data['message'])
|
entry += '\n\n{}\n\n'.format(data['message'])
|
||||||
|
|
||||||
with open('data/guestbook.html', 'a') as f:
|
with open('data/g/index.html', 'a') as f:
|
||||||
f.write(entry)
|
f.write(entry)
|
||||||
|
|
||||||
await event.reply('Entry added to t0.vc/g')
|
await event.reply('Entry added to t0.vc/g')
|
||||||
|
@ -60,6 +60,9 @@ async def submit(request):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise web.HTTPBadRequest(reason='You are missing something.')
|
raise web.HTTPBadRequest(reason='You are missing something.')
|
||||||
|
|
||||||
|
if not len(name) or not len(message):
|
||||||
|
raise web.HTTPBadRequest(reason='You are missing something.')
|
||||||
|
|
||||||
if len(name) > 50:
|
if len(name) > 50:
|
||||||
raise web.HTTPBadRequest(reason='Name is too long.')
|
raise web.HTTPBadRequest(reason='Name is too long.')
|
||||||
if len(website) > 100:
|
if len(website) > 100:
|
Loading…
Reference in New Issue
Block a user