-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33361d3
commit df15fb9
Showing
14 changed files
with
181 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__all__ = ["feed"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
from lib.controller import Action | ||
from lib.decorators import rss | ||
import action | ||
from action import feed | ||
import models | ||
|
||
class ArticleList(Action): | ||
LIST_PER_PAGE = 20 | ||
|
||
@rss(action.feed.CategoryArticleList) | ||
@rss(feed.Category) | ||
def get(self, category_name): | ||
page = int(self.request.get('page', 1)) | ||
offset = (page - 1) * self.LIST_PER_PAGE | ||
category = models.Category.get_by_name(category_name) | ||
self.list = models.Article.get_list(category, self.LIST_PER_PAGE, offset) if category else None | ||
self.count = category.article_count if category else 0 | ||
return Action.Result.DEFAULT | ||
return Action.Result.DEFAULT | ||
|
||
class Top(Action): | ||
def get(self): | ||
self.list = models.Category.get_top_level() | ||
return Action.Result.JSON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.