Hide keyboard shortcuts

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

1from datetime import datetime 

2from app import app 

3from app.docutils import topics 

4 

5@app.template_filter('name_by_type') 

6def item_name(item_type, plural=True): 

7 # 

8 # get name of the item_type 

9 # 

10 

11 # categories 

12 if item_type == 'main': 

13 name = 'Main Item' 

14 

15 # main items  

16 elif item_type == 'testrun': 

17 name = 'Testrun' 

18 elif item_type == 'testcase_sequence': 

19 name = 'Test Case Sequence' 

20 elif item_type == 'testcase': 

21 name = 'Test Case' 

22 elif item_type == 'teststep_sequence': 

23 name = 'Test Step Sequence' 

24 elif item_type == 'teststep': 

25 name = 'Test Step' 

26 else: 

27 # wrong item_type 

28 return '' 

29 

30 # check for plurals 

31 if plural: 

32 name += 's' 

33 

34 return name 

35 

36@app.template_filter('time') 

37def format_time(time): 

38 return time.strftime('%Y-%m-%d %H:%M') 

39 

40@app.template_filter('doc_title') 

41def documentation_title(topic): 

42 if topic in topics: 

43 return topics[topic] 

44 

45 return "Index" 

46 

47@app.context_processor 

48def doc_topics(): 

49 return dict(topics=topics)