def get(self): messages = Message.gql("ORDER BY date DESC LIMIT 30") template_values = { 'title': 'PintMe General Feed', 'link': 'http://pintme.appspot.com/', 'description': 'PintMe General Feed', 'items': messages } # We get the template path then show it path = os.path.join(os.path.dirname(__file__), '../views/rss.html') self.response.out.write(template.render(path, template_values))
def get(self, nickname): account = Account.gql("WHERE nickname = :1", nickname).get() messages = Message.gql("WHERE author IN :1 ORDER BY date DESC LIMIT 10", account.following) template_values = { 'title': nickname + '\'s feed', 'link': 'http://pintme.appspot.com/user/' + nickname, 'description': 'Personnal user feed for ' + nickname, 'items': messages } # We get the template path then show it path = os.path.join(os.path.dirname(__file__), '../views/rss.xml') self.response.out.write(template.render(path, template_values))
def getAllMessages(self, limit = 10): return Message.gql("ORDER BY date DESC").fetch(limit)
def getMessages(self, account, limit = 10): if account: return Message.gql( "WHERE author IN :1 ORDER BY date DESC", account.following ).fetch( limit ) else: return list()
def getSentMessages(self, account, limit = 10): if account: return Message.gql( "WHERE author = :1 ORDER BY date DESC", account.key() ).fetch( limit ) else: return list()