Permalink
Browse files

bug fix: filtered view

  • Loading branch information...
1 parent 7f66f6a commit c44c66243614ed2733bf59d59b32144c114e20ff @davidnieder committed Jan 20, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 post.py
View
12 post.py
@@ -43,20 +43,24 @@ def __init__(self, postId=None, username=None, userid=None, page=1, \
# add a filter
pass
else:
- self.get_posts( str(self.postTableColumns['user']) + \
+ self.get_posts( self.postTableColumns['user'] + \
'=\'%s\'' %self.username )
elif self.postFilter:
# Filtered view e.g. /posts/audio/
- self.get_posts( str(self.postTableColumns['contenttype']) + \
- '=%s' %contentkey[self.postFilter] )
+ if self.postFilter in contentkey:
+ self.get_posts( self.postTableColumns['contenttype'] + \
+ '=\'%s\'' %(contentkey[self.postFilter]) )
+ else:
+ self.get_posts( self.postTableColumns['date'] + \
+ '=\'%s\'' %(self.postFilter))
elif self.postId == 'all':
# Get summary of all posts
self.get_all_posts()
elif self.postId:
# Get special post
- self.get_posts( str(self.postTableColumns['id']) + \
+ self.get_posts( self.postTableColumns['id'] + \
'=%i' %self.postId )
else:
# Get index page

0 comments on commit c44c662

Please sign in to comment.