From 6ca4fb5f8e47d645b632f7acc7ceb320143fd961 Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Sat, 5 Jun 2010 01:15:33 +0800 Subject: [PATCH] generators: strip trailing whitespace --- generators.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/generators.py b/generators.py index 9df4989..7628f37 100644 --- a/generators.py +++ b/generators.py @@ -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: @@ -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: @@ -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. @@ -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()] @@ -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) @@ -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 @@ -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. @@ -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"]