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

1#!/usr/local/bin/python 

2# encoding: utf-8 

3""" 

4*The development tab for the PESSTO Object tickets* 

5 

6:Author: 

7 David Young 

8""" 

9import sys 

10import os 

11import re 

12import datetime 

13import khufu 

14 

15def development_tab( 

16 log, 

17 request, 

18 discoveryDataDictionary, 

19 objectAkas, 

20 atelData, 

21 objectHistories): 

22 """development tab 

23 

24 **Key Arguments** 

25 

26 - ``log`` -- logger 

27 - ``request`` -- the pyramid request 

28 - ``discoveryDataDictionary`` -- the unique discoveryData dictionary of the object in the pessto marshall database (from view_object_contextual_data) 

29 - ``objectAkas`` -- object akas 

30 - ``objectHistories`` -- the lightcurve data for the objects displayed on the webpage 

31 - ``atelData`` -- the atel matches for the objects displayed on the webpage 

32  

33 

34 **Return** 

35 

36 - ``development_tab`` -- for each transient ticket in the transient listings pages 

37  

38 """ 

39 from time import strftime 

40 from marshall_webapp.templates.commonelements.tickets.single_ticket import ticket_building_blocks, tabs 

41 from marshall_webapp.templates.commonelements.tickets import single_ticket 

42 from marshall_webapp.templates.commonelements import forms 

43 

44 log.debug('starting the ``development_tab`` function') 

45 

46 group = "" 

47 for item in request.effective_principals: 

48 if "group:" in item: 

49 group = item.replace("group:", "") 

50 if group not in ["superadmin"]: 

51 return None 

52 

53 lightcurve = transient_d3_lightcurve( 

54 log=log, 

55 discoveryDataDictionary=discoveryDataDictionary, 

56 request=request 

57 ) 

58 

59 development_tab = single_ticket._ticket_tab_template( 

60 log, 

61 request=request, 

62 tabHeader=False, 

63 blockList=[lightcurve], 

64 tabFooter=False, 

65 htmlId="developmenttab" 

66 ) 

67 

68 log.debug('completed the ``development_tab`` function') 

69 return development_tab 

70 

71def transient_d3_lightcurve( 

72 log, 

73 discoveryDataDictionary, 

74 request): 

75 """transient d3 lightcurve 

76 

77 **Key Arguments** 

78 

79 - ``dbConn`` -- mysql database connection 

80 - ``log`` -- logger 

81  

82 """ 

83 log.debug('starting the ``transient_d3_lightcurve`` function') 

84 

85 # print discoveryDataDictionary["transientBucketId"] 

86 

87 href = request.route_path('transients_element_lightcurves', elementId=discoveryDataDictionary[ 

88 "transientBucketId"], _query={'format': 'd3'}) 

89 

90 svg = khufu.svg( 

91 htmlClass="example01", 

92 dataUrl=href, 

93 dataFormat="json", 

94 disable=False, 

95 htmlId=False, 

96 chartType="lightcurve", 

97 span=7, 

98 height="square" 

99 ) 

100 

101 log.debug('completed the ``transient_d3_lightcurve`` function') 

102 return svg 

103 

104# xt-def-with-logger