Example #1
0
    def get(self):
        template_params = {}
        user = User.connect()
        user = User.checkUser()
        if not user:

            template_params['loginUrl'] = User.loginUrl(
                'simulator?myvar=' + self.request.get('myvar'))

        else:
            template_params['logoutUrl'] = User.logoutUrl()
            template_params['user'] = user.email
            template_params['name_recipe'] = self.request.get('myvar')
            details = Recipe.getDetailsByName(self.request.get('myvar'))
            template_params['pic_url'] = details.pic_url

            template_params['recipeStep'] = details.step

        most_recipes = Recipe.try_get_most_viewed()
        if (most_recipes):

            template_params['most_views'] = most_recipes

        html = template.render("web/templates/simulator.html", template_params)
        self.response.write(html)
Example #2
0
    def get(self):

        template_params = {}
        user = User.connect()
        user = User.checkUser()
        if not user:

            template_params['loginUrl'] = User.loginUrl('featured')
        else:
            template_params['user'] = user.email
            template_params['logoutUrl'] = User.logoutUrl()

        template_params['name_recipe'] = self.request.get('myvar')

        details = Recipe.getDetailsByName(self.request.get('myvar'))

        most_recipes = Recipe.try_get_most_viewed()

        if (most_recipes):

            template_params['most_views'] = most_recipes

        template_params['pic_url'] = details.pic_url
        Recipe.setCount(self.request.get('myvar'))

        ingredients = []
        ingredients = details.ingredients.split("\n")
        template_params['ingredients'] = ingredients

        template_params['recipeStep'] = details.step

        html = template.render("web/templates/featured.html", template_params)
        self.response.write(html)