def getArticles(self, type, startPage, limit): mongoService = MongoService() listArticles = [] start = (startPage - 1) * config.pageSize mark = common.getMark() listArticles = mongoService.getListArticles(type, start, limit, mark) return listArticles
def getArticles(self, type, startPage, limit): mongoService=MongoService() listArticles=[] start = (startPage-1)*config.pageSize mark = common.getMark() listArticles=mongoService.getListArticles(type, start, limit, mark) return listArticles
def getArticles(self, themes_array, limits): mongoService=MongoService() array=[] mark = common.getMark() for theme in themes_array: listArticles=mongoService.getMainArticles(theme["theme_id"], limits, mark) array.extend(listArticles) return array
def getArticles(self, type, limit): redisService = RedisService(self.log) mark = redisService.getArticlesMark() service = MongoService(self.log) articles = service.getArticles(type, limit, mark) return articles
def getArticle(self, articleId): mark = common.getMark() mongoService = MongoService() article = mongoService.getArticles(articleId, mark) return article
def getListArticlesSum(self, type): mark = common.getMark() mongoService = MongoService() sum = mongoService.getListArticlesSum(type, mark) return sum
def getThemeTitle(self, themeId): mongoService = MongoService() title = mongoService.getThemeTitle(themeId) return title
def getListArticlesSum(self, type): mark = common.getMark() mongoService=MongoService() sum = mongoService.getListArticlesSum(type, mark) return sum
def getThemeTitle(self,themeId): mongoService=MongoService() title = mongoService.getThemeTitle(themeId) return title
############################################################### # Use package flask (pip install flask) from flask import Flask, jsonify from flask import abort, make_response from flask import request from flask import url_for ############################################################### app = Flask(__name__) print("app: %s" % app) ############################################################### # Database service from MongoService import MongoService mongo = MongoService() mongo.collection = "tasks" ############################################################## # add url def make_public_task(task): new_task = {} for field in task: if field == 'id': new_task['uri'] = url_for('get_task', task_id=task['id'], _external=True) #else: # new_task[field] = task[field] new_task[field] = task[field]
def getArticle(self, articleId): mongoService = MongoService() article = mongoService.getArticles(articleId) return article
def getThemes(self, themes): mongoService=MongoService() return mongoService.getThemes(themes)