comparison bitsyblog/bitsyblog.py @ 34:2a43e43a7e4d

comment cleanup
author k0s <k0scist@gmail.com>
date Sun, 01 Nov 2009 01:51:14 -0400
parents 0826015cc13d
children 7e7fbdc64cc1
comparison
equal deleted inserted replaced
33:89f5158ef191 34:2a43e43a7e4d
112 # XXX to deprecate 112 # XXX to deprecate
113 res = Response(content_type=content_type, body=text) 113 res = Response(content_type=content_type, body=text)
114 return res 114 return res
115 115
116 def logo(self, request): 116 def logo(self, request):
117 """link to the logo"""
117 _logo = 'bitsyblog.png' # TODO: should go to self.logo 118 _logo = 'bitsyblog.png' # TODO: should go to self.logo
118 logo = os.path.join(self.file_dir, _logo) 119 logo = os.path.join(self.file_dir, _logo)
119 if os.path.exists(logo): 120 if os.path.exists(logo):
120 return self.link(request, _logo) 121 return self.link(request, _logo)
121 122
336 # write to the blog 337 # write to the blog
337 for i in range(len(entries)): 338 for i in range(len(entries)):
338 datestamp = utils.datestamp(dates[i]) 339 datestamp = utils.datestamp(dates[i])
339 self.blog.post(user, datestamp, entries[i], 'public') 340 self.blog.post(user, datestamp, entries[i], 'public')
340 341
341 # TODO: redirect to index page
342 return exc.HTTPOk("%s posts blogged" % len(entries)) 342 return exc.HTTPOk("%s posts blogged" % len(entries))
343 343
344 344
345 def error(self): 345 def error(self):
346 """deal with non-supported methods""" 346 """deal with non-supported methods"""
398 request.user = self.users[name] 398 request.user = self.users[name]
399 else: 399 else:
400 name = None 400 name = None
401 return name, path 401 return name, path
402 402
403 ### methods 403 ### methods for linking and URLs
404 404
405 def link(self, request, path='', permanant=False): 405 def link(self, request, path='', permanant=False):
406 if isinstance(path, basestring): 406 if isinstance(path, basestring):
407 path = [ path ] 407 path = [ path ]
408 path = [ i.strip('/') for i in path ] 408 path = [ i.strip('/') for i in path ]
513 raise BlogPathException(notfound) 513 raise BlogPathException(notfound)
514 514
515 # get the blog 515 # get the blog
516 return self.blog.entries(user, allowed, *path) 516 return self.blog.entries(user, allowed, *path)
517 517
518 ### methods that write HTML 518 ### methods for markup
519 519
520 def stylesheets(self, request): 520 def stylesheets(self, request):
521 user = getattr(request, 'user', None) 521 user = getattr(request, 'user', None)
522 if user: 522 if user:
523 stylesheets = request.user['CSS'] 523 stylesheets = request.user['CSS']
721 print >> retval, '</entry>' 721 print >> retval, '</entry>'
722 722
723 print >> retval, '</feed>' 723 print >> retval, '</feed>'
724 return retval.getvalue() 724 return retval.getvalue()
725 725
726 ### forms and accompanying display 726 ### forms
727 727
728 def form_post(self, request, user): 728 def form_post(self, request, user):
729 729
730 # genshi data 730 # genshi data
731 self.site_nav(request) 731 self.site_nav(request)