Exemplo n.º 1
0
def helpsettings():
    global reminderlist
    if request.method == "GET":
        if session.has_key("user") and session["user"] != "":
            tmp = util.getCurrentTime(session["user"])
            time = tmp.split(":")
            if "am" in time[1]:
                amorpm = "am"
            else:
                amorpm = "pm"
            hour = time[0]
            minute = time[1][:-2]
            tmpone = util.getStatus(session["user"])
            return render_template(
                "helpsettings.html",
                minutes=minutelist,
                hourselected=int(hour),
                minuteselected=minute,
                ampm=amorpm,
                enabled=tmpone,
            )
    else:
        if request.form.has_key("Back"):
            return redirect(url_for("calendar", year=int(util.thisYear()), month=util.thisMonth()))
        if request.form.has_key("Submit"):
            hour = request.form["hourselector"]
            minute = request.form["minuteselector"]
            amorpm = request.form["ampmselect"]
            reminders = request.form["enabledselect"]
            hour = str(hour)
            if int(hour) < 10:
                hour = "0" + hour
            newtime = hour + ":" + minute + amorpm
            util.setTime(util.getUserNumber(session["user"]), newtime)
            currentEnabled = util.getStatus(session["user"])
            if currentEnabled == True and reminders == "dis":
                util.changeStatus(util.getUserNumber(session["user"]))
            if currentEnabled == False and reminders == "en":
                util.changeStatus(util.getUserNumber(session["user"]))
            reminderlist = util.getReminderTimes()
            if threading.activeCount() > 1:
                threading.enumerate()[1].cancel()
            remindersHandler(True, 0)
            return redirect(url_for("helpsettings"))
Exemplo n.º 2
0
def helpsettings():
    global reminderlist
    if request.method =='GET':
        if session.has_key('user') and session['user'] != '':
            tmp = util.getCurrentTime(session['user'])
            time = tmp.split(':')
            if 'am' in time[1]:
                amorpm = 'am'
            else:
                amorpm = 'pm'
            hour = time[0]
            minute = time[1][:-2]
            tmpone = util.getStatus(session['user'])
            return render_template('helpsettings.html',minutes=minutelist,hourselected=int(hour),minuteselected=minute,ampm=amorpm,enabled=tmpone)
    else:
        if request.form.has_key('Back'):
            return redirect(url_for('calendar',year=int(util.thisYear()),month=util.thisMonth()))
        if request.form.has_key('Submit'):
            hour = request.form['hourselector']
            minute = request.form['minuteselector']
            amorpm = request.form['ampmselect']
            reminders = request.form['enabledselect']
            hour = str(hour)
            if int(hour) < 10:
                hour = "0" + hour
            newtime = hour+":"+minute+amorpm
            util.setTime(util.getUserNumber(session['user']),newtime)
            currentEnabled = util.getStatus(session['user'])
            if currentEnabled == True and reminders == 'dis':
                util.changeStatus(util.getUserNumber(session['user']))
            if currentEnabled == False and reminders == 'en':
                util.changeStatus(util.getUserNumber(session['user']))
            reminderlist = util.getReminderTimes()
            if threading.activeCount() > 1:
                threading.enumerate()[1].cancel()
            remindersHandler(True,0)
            return redirect(url_for('helpsettings'))
Exemplo n.º 3
0
def sendMail():
    print "Sending mail..."
    try:
        toList = "*****@*****.**"
        today = datetime.date.today()
        check = "please check the report"
        content = open(reportpath).read()
        message = util.mailtmpl % (today, check, content)
        token1 = "<strong>Status:</strong>"
        token2 = "</p>"
        flag = util.getStatus(content, token1, token2)
        emailSender = sendmail.SMTP_SSL("smtp.ops.xxx-inc.com")
        fromAdd = "*****@*****.**"
        title = "[Python-test-Report][Demo]%s@%s" % (flag, time.strftime("%Y%m%d"))
        ccList = ""
        emailSender.SendHTML("", "", fromAdd, toList, ccList, title, message)
        print "Sending mail done"
    except Exception, e:
        sys.stderr.write("Sending mail error: " + str(e) + "\n")
Exemplo n.º 4
0
def sendMail():
    print 'Sending mail...'
    try:
        toList = '*****@*****.**'
        today = datetime.date.today()
        check = "please check the report"
        content = open(reportpath).read()
        message = util.mailtmpl %(today,check,content)
        token1 = '<strong>Status:</strong>'
        token2 = '</p>'
        flag = util.getStatus(content,token1,token2)
        emailSender = sendmail.SMTP_SSL('smtp.ops.xxx-inc.com')
        fromAdd = '*****@*****.**'
        title = '[Python-test-Report][Demo]%s@%s' % (flag,time.strftime('%Y%m%d'))
        ccList = ''
        emailSender.SendHTML('', '', fromAdd, toList, ccList, title, message)
        print 'Sending mail done'
    except Exception, e:
        sys.stderr.write('Sending mail error: ' + str(e) + '\n')
Exemplo n.º 5
0
def sendMail():
    print 'Sending mail...'
    try:
        toList = '*****@*****.**'
        today = datetime.date.today()
        check = "please check the report"
        content = open(reportpath).read()
        message = util.mailtmpl % (today, check, content)
        token1 = '<strong>Status:</strong>'
        token2 = '</p>'
        flag = util.getStatus(content, token1, token2)
        emailSender = sendmail.SMTP_SSL('smtp.ops.xxx-inc.com')
        fromAdd = '*****@*****.**'
        title = '[Python-test-Report][Demo]%s@%s' % (flag,
                                                     time.strftime('%Y%m%d'))
        ccList = ''
        emailSender.SendHTML('', '', fromAdd, toList, ccList, title, message)
        print 'Sending mail done'
    except Exception, e:
        sys.stderr.write('Sending mail error: ' + str(e) + '\n')
Exemplo n.º 6
0
 def _getStatus(self):
     moduleStatus = [module.status for module in self.modules]
     robotStatus = getStatus(moduleStatus)
     return robotStatus
Exemplo n.º 7
0
 def _getStatus(self):
     motorStatus = [motor.status for motor in self.link.motor.values()]
     logger.debug("motorStatus: %s" % str(motorStatus) )
     moduleStatus = getStatus(motorStatus)
     logger.debug("moduleStatus: %s" % moduleStatus)
     return moduleStatus
Exemplo n.º 8
0
def status():
    if request.method == 'POST':
        return util.setStatus(request.data)
    elif request.method == 'GET':
        return util.getStatus()
Exemplo n.º 9
0
def main():
    while True:
    	cardId = input("cardId: ")
    	if getStatus():