Private
Public Access
1
0

removed some more old notokenerrors

This commit is contained in:
Sander Roosendaal
2018-06-26 12:54:27 +02:00
parent 3dc998d623
commit 55dd757823
4 changed files with 12 additions and 12 deletions

View File

@@ -54,7 +54,7 @@ def c2_open(user):
r = Rower.objects.get(user=user)
if (r.c2token == '') or (r.c2token is None):
s = "Token doesn't exist. Need to authorize"
raise C2NoTokenError("User has no token")
raise NoTokenError("User has no token")
else:
if (timezone.now()>r.tokenexpirydate):
res = rower_c2_token_refresh(user)
@@ -97,7 +97,7 @@ def get_c2_workouts(rower):
try:
thetoken = c2_open(rower.user)
except C2NoTokenError:
except NoTokenError:
return 0
res = get_c2_workout_list(rower.user,page=1)

View File

@@ -20,7 +20,7 @@ from time import strftime,strptime,mktime,time,daylight
import os
from rowers.tasks import handle_makeplot
from rowers.utils import serialize_list,deserialize_list
from rowers.c2stuff import C2NoTokenError
from rowers.utils import NoTokenError
from shutil import copyfile
from minimocktest import MockTestCase
@@ -425,7 +425,7 @@ class C2Tests(TestCase):
def c2_notokentest(self):
thetoken = c2_open(self.u)
# should raise C2NoTokenError
self.assertRaises(C2NoTokenError)
self.assertRaises(NoTokenError)
class DataTest(TestCase):
def setUp(self):

View File

@@ -20,7 +20,7 @@ from time import strftime,strptime,mktime,time,daylight
import os
from rowers.tasks import handle_makeplot
from rowers.utils import serialize_list,deserialize_list
from rowers.c2stuff import C2NoTokenError
from shutil import copyfile
from minimocktest import MockTestCase

View File

@@ -36,7 +36,7 @@ except:
from rowers.utils import (
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):
@@ -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)):
try:
message,id = c2stuff.workout_c2_upload(w.user.user,w)
except c2stuff.C2NoTokenError:
except NoTokenError:
id = 0
message = "Something went wrong with the Concept2 sync"
@@ -388,7 +388,7 @@ def do_sync(w,options):
message,id = stravastuff.workout_strava_upload(
w.user.user,w
)
except stravastuff.StravaNoTokenError:
except NoTokenError:
id = 0
message = "Please connect to Strava first"
@@ -398,7 +398,7 @@ def do_sync(w,options):
message,id = sporttracksstuff.workout_sporttracks_upload(
w.user.user,w
)
except sporttracksstuff.SportTracksNoTokenError:
except NoTokenError:
message = "Please connect to SportTracks first"
id = 0
@@ -408,7 +408,7 @@ def do_sync(w,options):
message,id = runkeeperstuff.workout_runkeeper_upload(
w.user.user,w
)
except runkeeperstuff.RunKeeperNoTokenError:
except NoTokenError:
message = "Please connect to Runkeeper first"
id = 0
@@ -417,7 +417,7 @@ def do_sync(w,options):
message,id = underarmourstuff.workout_ua_upload(
w.user.user,w
)
except underarmourstuff.UnderArmourNoTokenError:
except NoTokenError:
message = "Please connect to MapMyFitness first"
id = 0
@@ -427,7 +427,7 @@ def do_sync(w,options):
message,id = tpstuff.workout_tp_upload(
w.user.user,w
)
except tpstuff.TPNoTokenError:
except NoTokenError:
message = "Please connect to TrainingPeaks first"
id = 0