Пример #1
0
 def _createStatistic(self, key_name):
   data = self._createInitialData(key_name)
   entity = GSoCStatisticData.get_by_key_name(key_name) 
   if not entity:
     entity = GSoCStatisticData(key_name=key_name, data=data)
   else:
     entity.data = data
   return entity
Пример #2
0
 def initialize(self):
   entities = GSoCStatisticData.get_by_key_name(self._model_specific)
   for entity in entities:
     self._statistics[entity.key().name()] = {
         'entity': entity,
         'data': simplejson.loads(entity.data),
         'dirty': False
         }
Пример #3
0
  def _getDataSources(self, key_name):
    key_names = mapping.DEPENDENCIES[key_name]
    statistics = GSoCStatisticData.get_by_key_name(key_names)
    sources = {}
    for statistic in statistics:
      sources[statistic.key().name()] = simplejson.loads(statistic.data)

    if len(sources) != len(key_names):
      raise Exception('At least one of the dependencies cannot be loaded.')

    return sources
Пример #4
0
 def get(self, key_name):
   statistic = GSoCStatisticData.get_by_key_name(key_name)
   return statistic.data if statistic else {}