def _add_timezone(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.warning('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_timezone'] = self._format_tz_info(tzinfo)
Example #2
0
 def _add_timezone(self, raw_config):
     if u"timezone" in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u"timezone"])
         except tzinform.TimezoneNotFoundError, e:
             logger.warning("Unknown timezone: %s", e)
         else:
             raw_config[u"XX_timezone"] = u"TIMEZONE_OFFSET %d" % tzinfo["utcoffset"].as_seconds
 def _add_timezone(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.warning('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_timezone'] = self._format_tz_info(tzinfo)
Example #4
0
 def _add_timezone(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.warning('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_timezone'] = u'TIMEZONE_OFFSET %d' % tzinfo['utcoffset'].as_seconds
Example #5
0
 def _add_timezone(self, raw_config):
     if u"timezone" in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u"timezone"])
         except tzinform.TimezoneNotFoundError, e:
             logger.warning("Unknown timezone %s: %s", raw_config[u"timezone"], e)
         else:
             raw_config[u"XX_timezone"] = self._format_tzinfo(tzinfo)
 def _add_ntp_zone_num(self, raw_config):
     raw_config[u'XX_ntp_zone_num'] = self._NTP_ZONE_NUM_DEF
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.info('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_ntp_zone_num'] = self._tzinfo_to_zone_num(tzinfo)
Example #7
0
 def _add_timezone(self, raw_config):
     raw_config[u"XX_timezone"] = self._TZ_VALUE_DEF
     if u"timezone" in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u"timezone"])
         except tzinform.TimezoneNotFoundError, e:
             logger.info("Unknown timezone: %s", e)
         else:
             raw_config[u"XX_timezone"] = self._tzinfo_to_value(tzinfo)
 def _add_timezone(self, raw_config):
     raw_config[u'XX_timezone'] = self._TZ_VALUE_DEF
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.info('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_timezone'] = self._tzinfo_to_value(tzinfo)
Example #9
0
 def _add_timezone(self, device, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.info('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_timezone'] = self._extract_tzinfo(
                 device, tzinfo)
 def _add_timezone(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.warning('Unknown timezone: %s', e)
         else:
             raw_config[u'XX_timezone'] = u'TIMEZONE_OFFSET %d' % tzinfo[
                 'utcoffset'].as_seconds
Example #11
0
def _gen_tz_map():
    result = {}
    for tz_name, param_value in _ZONE_MAP.iteritems():
        tzinfo = tzinform.get_timezone_info(tz_name)
        inner_dict = result.setdefault(tzinfo["utcoffset"].as_minutes, {})
        if not tzinfo["dst"]:
            inner_dict[None] = param_value
        else:
            inner_dict[tzinfo["dst"]["as_string"]] = param_value
    return result
def _gen_tz_map():
    result = {}
    for tz_name, param_value in _ZONE_MAP.iteritems():
        tzinfo = tzinform.get_timezone_info(tz_name)
        inner_dict = result.setdefault(tzinfo['utcoffset'].as_minutes, {})
        if not tzinfo['dst']:
            inner_dict[None] = param_value
        else:
            inner_dict[tzinfo['dst']['as_string']] = param_value
    return result
def _gen_tz_map():
    result = {}
    for i, tz_name in enumerate(_ZONE_LIST):
        inform = tzinform.get_timezone_info(tz_name)
        inner_dict = result.setdefault(inform['utcoffset'].as_minutes, {})
        if not inform['dst']:
            inner_dict[None] = i
        else:
            inner_dict[inform['dst']['as_string']] = i
    return result
Example #14
0
 def _add_timezone(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.info('Unknown timezone: %s', e)
         else:
             try:
                 raw_config[u'XX_timezone'] = self._format_tzinfo(tzinfo)
             except Exception:
                 logger.error('Error while formating tzinfo', exc_info=True)
Example #15
0
 def _add_timezone(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError, e:
             logger.info('Unknown timezone: %s', e)
         else:
             try:
                 raw_config[u'XX_timezone'] = self._format_tzinfo(tzinfo)
             except Exception:
                 logger.error('Error while formating tzinfo', exc_info=True)
Example #16
0
 def _add_timezone_and_dst(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError as e:
             logger.info('Unknown timezone: %s', e)
         else:
             converter = _TimezoneConverter(tzinfo)
             raw_config[u'XX_timezone_offset'] = converter.default_offset()
             if converter.has_dst():
                 raw_config[u'XX_dst_offset'] = converter.dst_offset()
                 raw_config[u'XX_dst_start'] = converter.dst_start()
                 raw_config[u'XX_dst_end'] = converter.dst_end()
Example #17
0
 def _add_timezone_and_dst(self, raw_config):
     if u'timezone' in raw_config:
         try:
             tzinfo = tzinform.get_timezone_info(raw_config[u'timezone'])
         except tzinform.TimezoneNotFoundError as e:
             logger.info('Unknown timezone: %s', e)
         else:
             converter = _TimezoneConverter(tzinfo)
             raw_config[u'XX_timezone_offset'] = converter.default_offset()
             if converter.has_dst():
                 raw_config[u'XX_dst_offset'] = converter.dst_offset()
                 raw_config[u'XX_dst_start'] = converter.dst_start()
                 raw_config[u'XX_dst_end'] = converter.dst_end()