Coverage for modules/www/view.py: 81%

# Coverage for modules/www/view.py : 81%

## 16 statements

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 import json

2 import os

3

4 from flask import Blueprint

5 from flask import render_template

6

7 from shopyo.api.module import ModuleHelp

8 from shopyo.api.templates import yo_render

9

10# from flask import url_for

11# from flask import redirect

12# from flask import flash

13# from flask import request

14#

15# from shopyo.api.html import notify_success

16# from shopyo.api.forms import flash_errors

17# from shopyo.api.enhance import get_active_theme_dir

18# from shopyo.api.enhance import get_setting

19# from modules.box__ecommerce.shop.helpers import get_cart_data

20

21 mhelp = ModuleHelp(__file__, __name__)

22 globals()[mhelp.blueprint_str] = mhelp.blueprint

23 module_blueprint = globals()[mhelp.blueprint_str]

24

25

26@module_blueprint.route("/")

27 def index():

28 # cant be defined above but must be manually set each time

29 # active_theme_dir = os.path.join(

30 # dirpath, "..", "..", "themes", get_setting("ACTIVE_FRONT_THEME")

31 # )

32 # module_blueprint.template_folder = active_theme_dir

33

34 # return str(module_blueprint.template_folder)

35

36 # return render_template(get_setting("ACTIVE_FRONT_THEME") + "/index.html")

37

38 return render_template("www/index.html")

39

40

41@module_blueprint.route("/render_demo")

42 def render_demo():

43 context = {"fruit": "mango"}

44 return yo_render("blogus/render_demo.html", context)