@ -28,7 +28,7 @@ from hc.front.schemas import telegram_callback
from hc.front.templatetags.hc_extras import ( num_down_title , down_title ,
from hc.front.templatetags.hc_extras import ( num_down_title , down_title ,
sortchecks )
sortchecks )
from hc.lib import jsonschema
from hc.lib import jsonschema
from pytz import all_timezones
import pytz
from pytz.exceptions import UnknownTimeZoneError
from pytz.exceptions import UnknownTimeZoneError
import requests
import requests
@ -130,7 +130,7 @@ def my_checks(request):
" now " : timezone . now ( ) ,
" now " : timezone . now ( ) ,
" tags " : pairs ,
" tags " : pairs ,
" ping_endpoint " : settings . PING_ENDPOINT ,
" ping_endpoint " : settings . PING_ENDPOINT ,
" timezones " : all_timezones ,
" timezones " : pytz . all_timezones ,
" num_available " : request . team . check_limit - len ( checks ) ,
" num_available " : request . team . check_limit - len ( checks ) ,
" sort " : request . profile . sort ,
" sort " : request . profile . sort ,
" selected_tags " : selected_tags ,
" selected_tags " : selected_tags ,
@ -325,13 +325,11 @@ def cron_preview(request):
tz = request . POST . get ( " tz " )
tz = request . POST . get ( " tz " )
ctx = { " tz " : tz , " dates " : [ ] }
ctx = { " tz " : tz , " dates " : [ ] }
try :
try :
with timezone . override ( tz ) :
now_naive = timezone . make_naive ( timezone . now ( ) )
it = croniter ( schedule , now_naive )
for i in range ( 0 , 6 ) :
naive = it . get_next ( datetime )
aware = timezone . make_aware ( naive , is_dst = True )
ctx [ " dates " ] . append ( ( naive , aware ) )
zone = pytz . timezone ( tz )
now_local = timezone . localtime ( timezone . now ( ) , zone )
it = croniter ( schedule , now_local )
for i in range ( 0 , 6 ) :
ctx [ " dates " ] . append ( it . get_next ( datetime ) )
except UnknownTimeZoneError :
except UnknownTimeZoneError :
ctx [ " bad_tz " ] = True
ctx [ " bad_tz " ] = True
except :
except :
@ -420,7 +418,7 @@ def details(request, code):
" page " : " details " ,
" page " : " details " ,
" check " : check ,
" check " : check ,
" channels " : channels ,
" channels " : channels ,
" timezones " : all_timezones
" timezones " : pytz . all_timezones
}
}
return render ( request , " front/details.html " , ctx )
return render ( request , " front/details.html " , ctx )