Skip to content

Commit

Permalink
Replaced use of .fetch(1) with .get()
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachnid committed Jan 27, 2010
1 parent 6b415b5 commit 6568cf2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,13 @@ def get_prev_next(cls, post):
q = models.BlogPost.all().order('-published')
q.filter('published !=', datetime.datetime.max)# Filter drafts out
q.filter('published <', post.published)
prev = q.fetch(1)
prev = q.get()

q = models.BlogPost.all().order('published')
q.filter('published !=', datetime.datetime.max)# Filter drafts out
q.filter('published >', post.published)
next = q.fetch(1)
if len(prev) > 0:
prev = prev[0]
else:
prev = None
if len(next) > 0:
next = next[0]
else:
next = None
next = q.get()

return prev,next

@classmethod
Expand Down

0 comments on commit 6568cf2

Please sign in to comment.