def post_condition(self, request):
     app_config = appconfig.load_settings()
     config = app_config["locations"][request.location]
     c = condition.Condition(location=request.location, station=request.station, json=request.json)
     if c:
         memcache.set(key=c.location, value=c, namespace="conditions")
         # if it's raining, update the last rain datetime in the cache
         if c.is_raining:
             wxutils.update_last_rain(c.location, c.date)
         wxutils.update_high_low_averages(condition=c)
         # self.store_condition(request)
         if config and "wunderground" in config:
             wu_config = config["wunderground"]
             if "conditions" in wu_config and wu_config["conditions"]:
                 wu.post(condition=c, station=wu_config["station"], password=wu_config["password"])
     return message_types.VoidMessage()
  def upload_archive(self, request):
#    logging.info(request.json)
    app_config = appconfig.load_settings()
    config = app_config['locations'][request.location]
    logging.info('archive record date: ' + str(parser.parse(request.date)))
    #archive.DbArchive(location=request.location, 
    #                  date=parser.parse(request.date), json=request.json, station=request.station).put()
    archive_record = json_to_dbarchive(request.location, request.date, request.station, request.json)
    # check for dups (location + date)?
    # populate all fields
    # store the record
    if archive_record:
      archive.ArchiveFactory.put(archive_record)
      # update last rain
      if archive_record.rainfall > 0: wxutils.update_last_rain(archive_record.location, archive_record.date)
      if config and 'wunderground' in config:
        wu_config = config['wunderground']
        if 'archives' in wu_config and wu_config['archives']:
          wu.post(archive=archive_record, station=wu_config['station'], password=wu_config['password'])

      wxutils.update_high_low_averages(archive=archive_record)

    return message_types.VoidMessage()