removed some more old notokenerrors
This commit is contained in:
@@ -54,7 +54,7 @@ def c2_open(user):
|
|||||||
r = Rower.objects.get(user=user)
|
r = Rower.objects.get(user=user)
|
||||||
if (r.c2token == '') or (r.c2token is None):
|
if (r.c2token == '') or (r.c2token is None):
|
||||||
s = "Token doesn't exist. Need to authorize"
|
s = "Token doesn't exist. Need to authorize"
|
||||||
raise C2NoTokenError("User has no token")
|
raise NoTokenError("User has no token")
|
||||||
else:
|
else:
|
||||||
if (timezone.now()>r.tokenexpirydate):
|
if (timezone.now()>r.tokenexpirydate):
|
||||||
res = rower_c2_token_refresh(user)
|
res = rower_c2_token_refresh(user)
|
||||||
@@ -97,7 +97,7 @@ def get_c2_workouts(rower):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
thetoken = c2_open(rower.user)
|
thetoken = c2_open(rower.user)
|
||||||
except C2NoTokenError:
|
except NoTokenError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
res = get_c2_workout_list(rower.user,page=1)
|
res = get_c2_workout_list(rower.user,page=1)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from time import strftime,strptime,mktime,time,daylight
|
|||||||
import os
|
import os
|
||||||
from rowers.tasks import handle_makeplot
|
from rowers.tasks import handle_makeplot
|
||||||
from rowers.utils import serialize_list,deserialize_list
|
from rowers.utils import serialize_list,deserialize_list
|
||||||
from rowers.c2stuff import C2NoTokenError
|
from rowers.utils import NoTokenError
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
from minimocktest import MockTestCase
|
from minimocktest import MockTestCase
|
||||||
@@ -425,7 +425,7 @@ class C2Tests(TestCase):
|
|||||||
def c2_notokentest(self):
|
def c2_notokentest(self):
|
||||||
thetoken = c2_open(self.u)
|
thetoken = c2_open(self.u)
|
||||||
# should raise C2NoTokenError
|
# should raise C2NoTokenError
|
||||||
self.assertRaises(C2NoTokenError)
|
self.assertRaises(NoTokenError)
|
||||||
|
|
||||||
class DataTest(TestCase):
|
class DataTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from time import strftime,strptime,mktime,time,daylight
|
|||||||
import os
|
import os
|
||||||
from rowers.tasks import handle_makeplot
|
from rowers.tasks import handle_makeplot
|
||||||
from rowers.utils import serialize_list,deserialize_list
|
from rowers.utils import serialize_list,deserialize_list
|
||||||
from rowers.c2stuff import C2NoTokenError
|
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
from minimocktest import MockTestCase
|
from minimocktest import MockTestCase
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ except:
|
|||||||
|
|
||||||
from rowers.utils import (
|
from rowers.utils import (
|
||||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||||
str2bool,range_to_color_hex,absolute,myqueue
|
str2bool,range_to_color_hex,absolute,myqueue,NoTokenError
|
||||||
)
|
)
|
||||||
|
|
||||||
def cleanbody(body):
|
def cleanbody(body):
|
||||||
@@ -379,7 +379,7 @@ def do_sync(w,options):
|
|||||||
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and isprorower(w.user)):
|
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
||||||
except c2stuff.C2NoTokenError:
|
except NoTokenError:
|
||||||
id = 0
|
id = 0
|
||||||
message = "Something went wrong with the Concept2 sync"
|
message = "Something went wrong with the Concept2 sync"
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ def do_sync(w,options):
|
|||||||
message,id = stravastuff.workout_strava_upload(
|
message,id = stravastuff.workout_strava_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
)
|
)
|
||||||
except stravastuff.StravaNoTokenError:
|
except NoTokenError:
|
||||||
id = 0
|
id = 0
|
||||||
message = "Please connect to Strava first"
|
message = "Please connect to Strava first"
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ def do_sync(w,options):
|
|||||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
)
|
)
|
||||||
except sporttracksstuff.SportTracksNoTokenError:
|
except NoTokenError:
|
||||||
message = "Please connect to SportTracks first"
|
message = "Please connect to SportTracks first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ def do_sync(w,options):
|
|||||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
)
|
)
|
||||||
except runkeeperstuff.RunKeeperNoTokenError:
|
except NoTokenError:
|
||||||
message = "Please connect to Runkeeper first"
|
message = "Please connect to Runkeeper first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
@@ -417,7 +417,7 @@ def do_sync(w,options):
|
|||||||
message,id = underarmourstuff.workout_ua_upload(
|
message,id = underarmourstuff.workout_ua_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
)
|
)
|
||||||
except underarmourstuff.UnderArmourNoTokenError:
|
except NoTokenError:
|
||||||
message = "Please connect to MapMyFitness first"
|
message = "Please connect to MapMyFitness first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ def do_sync(w,options):
|
|||||||
message,id = tpstuff.workout_tp_upload(
|
message,id = tpstuff.workout_tp_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
)
|
)
|
||||||
except tpstuff.TPNoTokenError:
|
except NoTokenError:
|
||||||
message = "Please connect to TrainingPeaks first"
|
message = "Please connect to TrainingPeaks first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user