Mercurial > hg > bitsyblog
changeset 21:7cdb3eecc045
make post form genshi
author | k0s <k0scist@gmail.com> |
---|---|
date | Fri, 30 Oct 2009 18:49:10 -0400 |
parents | 1554cb56aa2f |
children | 1f5e89b64573 |
files | bitsyblog/bitsyauth.py bitsyblog/bitsyblog.py bitsyblog/templates/post.html |
diffstat | 3 files changed, 35 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bitsyblog/bitsyauth.py Sun Oct 25 21:36:33 2009 -0400 +++ b/bitsyblog/bitsyauth.py Fri Oct 30 18:49:10 2009 -0400 @@ -187,7 +187,7 @@ def login_form(self, referer=None, action=None): if action is None: action = self.urls['login'] - form = Form(action=action, submit='Login') + form = Form(action='', submit='Login') form.add_element('textfield', 'Name', input_name='username') form.add_element('password', 'Password', input_name='password') if referer is not None:
--- a/bitsyblog/bitsyblog.py Sun Oct 25 21:36:33 2009 -0400 +++ b/bitsyblog/bitsyblog.py Fri Oct 30 18:49:10 2009 -0400 @@ -783,6 +783,18 @@ ### forms and accompanying display def form_post(self, request, user): + + # genshi data + self.site_nav(request) + data = request.environ['data'] + data['user'] = user + data['stylesheets'] = self.stylesheets(request) + data['user_url'] = self.user_url + + # render the template + template = self.loader.load('post.html') + return template.generate(**data).render() + retval = StringIO() print >> retval, '<form action="/%s" method="post">' % self.user_url(request, user) print >> retval, '<textarea cols="80" rows="25" name="form-post"></textarea><br/>'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bitsyblog/templates/post.html Fri Oct 30 18:49:10 2009 -0400 @@ -0,0 +1,22 @@ +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:py="http://genshi.edgewall.org/" + xmlns:xi="http://www.w3.org/2001/XInclude"> + <head> + <title>post - ${user}</title> +<!-- <link href="${link(request, 'css/site.css')}" type="text/css" rel="stylsheet" title="Default"/> --> + </head> + <body> + <xi:include href="navigation.html" /> + + <form action="${user_url(request, user)}" method="post"> + <textarea cols="80" rows="25" name="form-post">${''}</textarea><br/> + <span title="viewable to everyone">public<input checked="checked" type="radio" name="privacy" value="public"/></span> + <span title="viewable only to your friends">secret<input type="radio" name="privacy" value="secret"/></span> + <span title="viewable only to you">private<input type="radio" name="privacy" value="private"/></span> + <input type="submit" name="submit" value="Post"/> + </form> + </body> +</html>