Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
generators: strip trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rctay authored and Arachnid committed Feb 3, 2011
1 parent dcbad4a commit 6ca4fb5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def name(cls):
@classmethod
def get_resource_list(cls, post):
"""Returns a list of resources for the given post.
Args:
post: A BlogPost entity.
Returns:
Expand All @@ -40,7 +40,7 @@ def get_resource_list(cls, post):
@classmethod
def get_etag(cls, post):
"""Returns a string that changes if the resource requires regenerating.
Args:
post: A BlogPost entity.
Returns:
Expand All @@ -52,7 +52,7 @@ def get_etag(cls, post):
@classmethod
def generate_resource(cls, post, resource):
"""(Re)generates a resource for the provided post.
Args:
post: A BlogPost entity.
resource: A resource string as returned by get_resource_list.
Expand All @@ -62,9 +62,9 @@ def generate_resource(cls, post, resource):

class PostContentGenerator(ContentGenerator):
"""ContentGenerator for the actual blog post itself."""

can_defer = False

@classmethod
def get_resource_list(cls, post):
return [post.key().id()]
Expand All @@ -75,14 +75,14 @@ def get_etag(cls, post):

@classmethod
def get_prev_next(cls, post):
"""Retrieves the chronologically previous and next post for this post"""
"""Retrieves the chronologically previous and next post for this post"""
import models

q = models.BlogPost.all().order('-published')
q.filter('published !=', datetime.datetime.max)# Filter drafts out
q.filter('published <', post.published)
prev = q.get()

q = models.BlogPost.all().order('published')
q.filter('published !=', datetime.datetime.max)# Filter drafts out
q.filter('published >', post.published)
Expand Down Expand Up @@ -115,13 +115,13 @@ def generate_resource(cls, post, resource, action='post'):

class PostPrevNextContentGenerator(PostContentGenerator):
"""ContentGenerator for the blog posts chronologically before and after the blog post."""

@classmethod
def get_resource_list(cls, post):
prev, next = cls.get_prev_next(post)
resource_list = [res.key().id() for res in (prev,next) if res is not None]
return resource_list
return resource_list

@classmethod
def generate_resource(cls, post, resource):
import models
Expand Down Expand Up @@ -154,7 +154,7 @@ def get_etag(cls, post):
@classmethod
def _filter_query(cls, resource, q):
"""Applies filters to the BlogPost query.
Args:
resource: The resource being generated.
q: The query to act on.
Expand Down Expand Up @@ -227,7 +227,7 @@ def _filter_query(cls, resource, q):

class AtomContentGenerator(ContentGenerator):
"""ContentGenerator for Atom feeds."""

@classmethod
def get_resource_list(cls, post):
return ["atom"]
Expand Down

0 comments on commit 6ca4fb5

Please sign in to comment.