def get(self):
        self.session = Session()
        que = db.Query(Device)
        device_list = que.fetch(limit=2000)

        deviceCount = db.GqlQuery(
            "SELECT * FROM Device").count()  #get number of Registered Devices
        query = db.GqlQuery(
            "SELECT * FROM Device")  #Total Number of Sent Notifications
        notificationTotalSentCount = 0
        for device in query:
            notificationTotalSentCount = notificationTotalSentCount + device.numberOfNotificationsSent

#Environment (testing or production)
        ereturn = functions.productionEnvironment()
        if ereturn == '0': environment = "Dev Environment"
        if ereturn == '1': environment = "Production Environment"

        doRender(
            self, 'devices.htm', {
                'notificationTotalSentCount': notificationTotalSentCount,
                'deviceCount': deviceCount,
                'device_list': device_list,
                'environment': environment
            })
    def get(self):
        logging.info('Login Page Rendered')

        #Environment (testing or production)
        ereturn = functions.productionEnvironment()
        if ereturn == '0': environment = "Dev Environment"
        if ereturn == '1': environment = "Prod Environment"
        logging.info('ereturn: ' + ereturn)

        doRender(self, 'loginscreen.htm', {'environment': environment})
    def get(self):
        self.session = Session()
        logging.info('In StatsHandler')

        #Stock Stats
        #TBA
        stockCount = ''

        #Environment (testing or production)
        ereturn = functions.productionEnvironment()
        if ereturn == '0':
            environment = "Dev Environment"
        if ereturn == '1':
            environment = "Prod Environment"
        logging.info('ereturn: ' + ereturn)

        #Notification Stats
        query = db.GqlQuery("SELECT * FROM Notification")
        notificationCount = query.count()

        #Total Number of Sent Notifications
        query = db.GqlQuery("SELECT * FROM Device")
        notificationTotalSentCount = 0
        for device in query:
            notificationTotalSentCount = notificationTotalSentCount + device.numberOfNotificationsSent
            logging.debug(str(notificationTotalSentCount))

        #Device Stats
        query = db.GqlQuery("SELECT * FROM Device")
        deviceCount = query.count()

        #Engine Stats
        engineStatRunDate = memcache.get('notificationenginestat_runDate')
        engineStatChecks = memcache.get('notificationenginestat_checks')
        engineStatCheckTime = memcache.get('notificationenginestat_checkTime')
        engineStatSentLastRun = memcache.get(
            'notificationenginestat_sentLastRun')
        engineStatSpeed = memcache.get('notificationenginestat_speed')

        doRender(
            self, 'stats.htm', {
                'environment': environment,
                'stockCount': stockCount,
                'notification_count': notificationCount,
                'notification_totalcount': notificationTotalSentCount,
                'device_count': deviceCount,
                'engine_rundate': engineStatRunDate,
                'engine_checks': engineStatChecks,
                'engine_checktime': engineStatCheckTime,
                'engine_lastrun': engineStatSentLastRun,
                'engine_speed': engineStatSpeed
            })
    def get(self):

        #Environment (testing or production)
        ereturn = functions.productionEnvironment()
        if ereturn == '0': environment = "Dev Environment"
        if ereturn == '1': environment = "Production Environment"
        logging.info("-------")
        logging.info("Starting Engine")
        logging.info("Environment: " + environment)
        logging.info("-------")

        if doRender(self, self.request.path):
            return
        doRender(self, 'index.htm', {'environment': environment})
    def get(self):
        self.session = Session()

        #Environment (testing or production)
        ereturn = functions.productionEnvironment()
        if ereturn == '0': environment = "Dev Environment"
        if ereturn == '1': environment = "Production Environment"

        que = db.Query(Notification)
        notification_list = que.fetch(limit=500000)
        doRender(self, 'notifications.htm', {
            'notification_list': notification_list,
            'environment': environment
        })
    def get(self):
        self.session = Session()
        que = db.Query(User)
        user_list = que.fetch(limit=500)

        #Environment (testing or production)
        ereturn = functions.productionEnvironment()
        if ereturn == '0': environment = "Dev Environment"
        if ereturn == '1': environment = "Production Environment"

        doRender(self, 'memberscreen.htm', {
            'user_list': user_list,
            'environment': environment
        })