Пример #1
0
 def initialize(self, web_settings):
     ''' Tornado handler `.initialize() <http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.initialize>`_ function for all requests to the annotation lookup endpoint.
     Here, the allowed arguments are set (depending on the request method) for each kwarg category.'''
     super(BiothingHandler, self).initialize(web_settings)
     self.ga_event_object_ret['action'] = self.request.method
     if self.request.method == 'GET':
         self.ga_event_object_ret['action'] = self.web_settings.GA_ACTION_ANNOTATION_GET
         self.control_kwargs = self.web_settings.ANNOTATION_GET_CONTROL_KWARGS
         self.es_kwargs = self.web_settings.ANNOTATION_GET_ES_KWARGS
         self.esqb_kwargs = self.web_settings.ANNOTATION_GET_ESQB_KWARGS
         self.transform_kwargs = self.web_settings.ANNOTATION_GET_TRANSFORM_KWARGS
     elif self.request.method == 'POST':
         self.ga_event_object_ret['action'] = self.web_settings.GA_ACTION_ANNOTATION_POST
         self.control_kwargs = self.web_settings.ANNOTATION_POST_CONTROL_KWARGS
         self.es_kwargs = self.web_settings.ANNOTATION_POST_ES_KWARGS
         self.esqb_kwargs = self.web_settings.ANNOTATION_POST_ESQB_KWARGS
         self.transform_kwargs = self.web_settings.ANNOTATION_POST_TRANSFORM_KWARGS
     else:
         # handle other verbs?
         pass
     self.kwarg_settings = sum_arg_dicts(self.control_kwargs, self.es_kwargs,
                                         self.esqb_kwargs, self.transform_kwargs)
     logging.debug("BiothingHandler - {}".format(self.request.method))
     logging.debug("Google Analytics Base object: {}".format(self.ga_event_object_ret))
     logging.debug("Kwarg settings: {}".format(self.kwarg_settings))
Пример #2
0
 def initialize(self, web_settings):
     ''' Tornado handler `.initialize() <http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.initialize>`_ function for all requests to the metadata endpoint.
     Here, the allowed arguments are set (depending on the request method) for each kwarg category.'''
     super(MetadataHandler, self).initialize(web_settings)
     if self.request.method == 'GET':
         self.control_kwargs = self.web_settings.METADATA_GET_CONTROL_KWARGS
         self.es_kwargs = self.web_settings.METADATA_GET_ES_KWARGS
         self.esqb_kwargs = self.web_settings.METADATA_GET_ESQB_KWARGS
         self.transform_kwargs = self.web_settings.METADATA_GET_TRANSFORM_KWARGS
         self.kwarg_settings = sum_arg_dicts(self.control_kwargs,
                                             self.es_kwargs,
                                             self.esqb_kwargs,
                                             self.transform_kwargs)
     logging.debug("MetadataHandler - {}".format(self.request.method))
     logging.debug("Kwarg settings: {}".format(self.kwarg_settings))