Mercurial > hg > bitsyblog
changeset 82:9e5dd802ba95
whitespace
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 17 Nov 2011 12:03:04 -0800 |
parents | 77aaa99c8221 |
children | 666f3051ce31 |
files | bitsyblog/bitsyblog.py |
diffstat | 1 files changed, 14 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py Thu Nov 17 11:50:54 2011 -0800 +++ b/bitsyblog/bitsyblog.py Thu Nov 17 12:03:04 2011 -0800 @@ -66,7 +66,7 @@ 'POST': self.post, 'PUT': self.put } - + # abstract attributes from user import FilespaceUsers @@ -81,11 +81,10 @@ for directory in self.template_directories: assert os.path.isdir(directory), "Bitsyblog template directory %s does not exist!" % directory - + self.template_directories.append(resource_filename(__name__, 'templates')) self.loader = TemplateLoader(self.template_directories, auto_reload=self.auto_reload) - # helpfile if self.help_file and os.path.exists(self.help_file): @@ -139,7 +138,7 @@ def logo(self, request): """link to the logo""" - _logo = 'bitsyblog.png' # TODO: should go to self.logo + _logo = 'bitsyblog.png' # TODO: should go to self.logo logo = os.path.join(self.file_dir, _logo) if os.path.exists(logo): return self.link(request, _logo) @@ -176,7 +175,7 @@ ### static files - # site.css + # site.css if path == 'css/site.css': css_file = os.path.join(self.file_dir, 'site.css') return FileApp(css_file) @@ -207,7 +206,7 @@ if check is not None: return check return Response(content_type='text/html', body=self.preferences(request, user)) - + if path == [ 'rss' ]: feed = 'rss' path = [] @@ -246,13 +245,13 @@ if feed == 'atom': content = self.atom(request, blog, user) # XXX different signatures return Response(content_type='text/xml', body=content) - + # reverse the blog if necessary if request.GET.get('sort') == 'forward': blog = list(reversed(blog)) n_links = self.number_of_links(request, user) - + # write the blog if request.GET.get('format') == 'text': content = self.text_blog(blog) @@ -282,7 +281,7 @@ """ write a blog entry and other POST requests """ - + # find user + path user, path = self.userpath(request) @@ -295,7 +294,7 @@ if len(path): if path == [ 'preferences' ]: - + # make the data look like we want settings = {} settings['Date format'] = request.POST.get('Date format') @@ -303,11 +302,11 @@ settings['Stylesheet'] = request.POST['Stylesheet'] settings['CSS file'] = request.POST.get('CSS file') settings['Friends'] = ', '.join(request.POST.getall('Friends')) - + errors = self.users.write_settings(user, **settings) - if errors: # re-display form with errors + if errors: # re-display form with errors return self.get_response(self.preferences(request, user, errors)) - + return self.get_response(self.preferences(request, user, message='Changes saved')) elif len(path) == 1 and self.isentry(path[0]): entry = self.blog.entry(user, path[0], roles['author']) @@ -321,13 +320,13 @@ return exc.HTTPSeeOther("Settings updated", location=self.user_url(request, user, datestamp)) else: return exc.HTTPMethodNotAllowed("Not sure what you're trying to do") - + # get the body of the post body = request.body body = request.POST.get('form-post', body) body = body.strip() if not body: - return exc.HTTPSeeOther("Your post has no content! No blog for you", + return exc.HTTPSeeOther("Your post has no content! No blog for you", location=self.user_url(request, user, 'post')) # determine if the post is secret or private