fixed bug where non-integral types would be compared accidentally

This commit is contained in:
Kjistóf 2017-03-05 09:29:49 +01:00
parent a8ada1621e
commit ab0dd17687

View File

@ -8,21 +8,32 @@ from requests.exceptions import ConnectionError
def main(wf): def main(wf):
num = None num = None
subtt = u'' subtt = u''
try: try:
num = str(get_week.get_week()) num = str(get_week.get_week())
title = u'Épp {}.'.format(num) title = u'Épp {}.'
subtt = u'hét van!' subtt = u'hét van!'
if num == 14: title = u'Póthét ({}. hét)'.format(num); subtt = u'van!'
if num > 14: title = u'Vizsgaidőszak ({}. hét)'.format(num); subtt = u'van!' if int(num) == 14:
title = u'Póthét ({}. hét)'
subtt = u'van!'
if int(num) > 14:
title = u'Vizsgaidőszak ({}. hét)'
subtt = u'van!'
title = title.format(num)
except ConnectionError: except ConnectionError:
title = u'Nincs internet!' title = u'Nincs internet!'
except (IndexError, RuntimeError): except (IndexError, RuntimeError):
title = u'A KTH összebarmolta a honlapját!' title = u'A KTH összebarmolta a honlapját!'
except EnvironmentError: except EnvironmentError:
title = u'Nyár van, nyugi!' title = u'Nyár van, nyugi!'
wf.add_item(title=title, subtitle=subtt, arg=num, valid=True) wf.add_item(title=title, subtitle=subtt, arg=num, valid=True)
wf.send_feedback() wf.send_feedback()
if __name__ == '__main__': if __name__ == '__main__':
wf = Workflow() wf = Workflow()
sys.exit(wf.run(main)) sys.exit(wf.run(main))