Commit d1ce9d39 by Tom Christie

More consistent comment style.

parent dea4a45e
...@@ -689,7 +689,9 @@ class PaginatorMixin(object): ...@@ -689,7 +689,9 @@ class PaginatorMixin(object):
limit = 20 limit = 20
def get_limit(self): def get_limit(self):
""" Helper method to determine what the `limit` should be """ """
Helper method to determine what the `limit` should be
"""
try: try:
limit = int(self.request.GET.get('limit', self.limit)) limit = int(self.request.GET.get('limit', self.limit))
return min(limit, self.limit) return min(limit, self.limit)
...@@ -697,7 +699,9 @@ class PaginatorMixin(object): ...@@ -697,7 +699,9 @@ class PaginatorMixin(object):
return self.limit return self.limit
def url_with_page_number(self, page_number): def url_with_page_number(self, page_number):
""" Constructs a url used for getting the next/previous urls """ """
Constructs a url used for getting the next/previous urls
"""
url = URLObject.parse(self.request.get_full_path()) url = URLObject.parse(self.request.get_full_path())
url = url.add_query_param('page', page_number) url = url.add_query_param('page', page_number)
...@@ -708,7 +712,9 @@ class PaginatorMixin(object): ...@@ -708,7 +712,9 @@ class PaginatorMixin(object):
return url return url
def next(self, page): def next(self, page):
""" Returns a url to the next page of results (if any) """ """
Returns a url to the next page of results (if any)
"""
if not page.has_next(): if not page.has_next():
return None return None
...@@ -722,7 +728,9 @@ class PaginatorMixin(object): ...@@ -722,7 +728,9 @@ class PaginatorMixin(object):
return self.url_with_page_number(page.previous_page_number()) return self.url_with_page_number(page.previous_page_number())
def serialize_page_info(self, page): def serialize_page_info(self, page):
""" This is some useful information that is added to the response """ """
This is some useful information that is added to the response
"""
return { return {
'next': self.next(page), 'next': self.next(page),
'page': page.number, 'page': page.number,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment