Exemplo n.º 1
0
 def toDotDict(self):
     """
     Convenience function to use if you want to use dot notation recursively
     everywhere within the parsed JSON.
     """
     return DotDict(dict([(k, convertToDotDictRecurse(v))
                          for k, v in self.__dict__.iteritems()]))
Exemplo n.º 2
0
 def toDotDict(self):
     """
     Convenience function to use if you want to use dot notation recursively
     everywhere within the parsed JSON.
     """
     return DotDict(
         dict([(k, convertToDotDictRecurse(v))
               for k, v in self.__dict__.iteritems()]))
Exemplo n.º 3
0
 def jsonHandler(topicPrefix, body):
     return handler(topicPrefix,
                    convertToDotDictRecurse(json.loads(body)))
Exemplo n.º 4
0
def loadConfig(path):
    f = open(path, 'r')
    j = json.load(f)
    return convertToDotDictRecurse(j)
Exemplo n.º 5
0
 def jsonHandler(topicPrefix, body):
     return handler(topicPrefix, convertToDotDictRecurse(json.loads(body)))
Exemplo n.º 6
0
def loadConfig(path):
    f = open(path, 'r')
    j = json.load(f)
    return convertToDotDictRecurse(j)
Exemplo n.º 7
0
from geocamUtil import anyjson as json
from geocamUtil.models.ExtrasDotField import convertToDotDictRecurse
from geocamUtil.loader import LazyGetModelByName

from xgds_status_board.models import StatusboardAnnouncement, StatusboardEvent, SubsystemGroup, Subsystem
from xgds_status_board import settings

from subprocess import Popen, PIPE
from time import sleep as time_sleep


# pylint: disable=E1101
default_timezone_offset = 0
XGDS_STATUS_BOARD_TEMPLATE_LIST = list(settings.XGDS_STATUS_BOARD_HANDLEBARS_DIR)
timezones = convertToDotDictRecurse(settings.STATUS_BOARD_TIMEZONES)


#print 'CALCULATING TIMEZONES WE HAVE %d' % len(timezones)
for timezone in timezones:
    timezone.tzobject = pytz.timezone(timezone.code)


def getMultiTimezones(time):
    """
    given a datetime that is in utc, return that time as the timezones defined in settings.
    """
    utc_time = utc.localize(time)
    return [(tz.name, utc_time.astimezone(tz.tzobject), tz.color)
            for tz in timezones]