Mercurial > hg > bitsyblog
comparison bitsyblog/bitsyblog.py @ 105:67e01fc5e360
STUB: bitsyblog/bitsyblog.py bitsyblog/factory.py bitsyblog/user.py
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 23 Feb 2014 17:45:22 -0800 |
parents | bc08a00a7d93 |
children | 1fc637c3acc0 |
comparison
equal
deleted
inserted
replaced
104:3198edbf7d8e | 105:67e01fc5e360 |
---|---|
252 | 252 |
253 # return the content | 253 # return the content |
254 return Response(content_type=content_type, body=content) | 254 return Response(content_type=content_type, body=content) |
255 | 255 |
256 def get(self, request): | 256 def get(self, request): |
257 """ | 257 """respond to a get request""" |
258 respond to a get request | |
259 """ | |
260 | 258 |
261 # front matter of the site | 259 # front matter of the site |
262 index = self.get_index(request) | 260 index = self.get_index(request) |
263 if index is not None: | 261 if index is not None: |
264 return index | 262 return index |
335 # fire event handlers | 333 # fire event handlers |
336 # XXX could be done asynchronously | 334 # XXX could be done asynchronously |
337 for handler in self.handlers: | 335 for handler in self.handlers: |
338 try: | 336 try: |
339 handler(blog_entry, location) | 337 handler(blog_entry, location) |
340 except: # XXX bare except! | 338 except Exception as e: # XXX bare except! |
341 pass | 339 print ("Error processing {}: {}".format(handler, e)) |
342 | 340 |
343 # point the user at the post | 341 # point the user at the post |
344 return exc.HTTPSeeOther("Post blogged by bitsy", location=location) | 342 return exc.HTTPSeeOther("Post blogged by bitsy", location=location) |
345 | 343 |
346 def put(self, request): | 344 def put(self, request): |
570 links.extend([(self.user_url(request, user), user), | 568 links.extend([(self.user_url(request, user), user), |
571 (self.user_url(request, user, 'post'), 'post'), | 569 (self.user_url(request, user, 'post'), 'post'), |
572 (self.user_url(request, user, 'preferences'), 'preferences'), | 570 (self.user_url(request, user, 'preferences'), 'preferences'), |
573 (self.link(request, 'logout'), 'logout')]) | 571 (self.link(request, 'logout'), 'logout')]) |
574 else: | 572 else: |
575 links.extend([(self.link(request, 'login'), 'login'), | 573 links.extend([(self.link(request, 'login'), 'login'), |
576 (self.link(request, 'join'), 'join')]) | 574 (self.link(request, 'join'), 'join')]) |
577 | 575 |
578 if hasattr(self, 'help'): | 576 if hasattr(self, 'help'): |
579 links.append((self.link(request, 'help'), 'help')) | 577 links.append((self.link(request, 'help'), 'help')) |
580 | 578 |