Private
Public Access
1
0

email processing working on develop

This commit is contained in:
Sander Roosendaal
2017-09-26 19:34:00 +02:00
parent b6d02cb2b6
commit 9e0b38c5a2
3 changed files with 35 additions and 22 deletions

View File

@@ -28,10 +28,13 @@ from rowers.utils import (
)
def cleanbody(body):
p = re.compile('.*---\n([\s\S]*)...')
m = p.match(body)
if m != None:
body = m.group(1)
regex = r".*---\n([\s\S]*?)\.\.\..*"
matches = re.finditer(regex,body)
for m in matches:
if m != None:
body = m.group(0)
return body
@@ -191,7 +194,7 @@ def do_sync(w,options):
if 'upload_to_C2' in options and options['upload_to_C2']:
try:
message,id = c2stuff.workout_c2_upload(w.user.user,w)
except C2NoTokenError:
except c2stuff.C2NoTokenError:
id = 0
message = "Something went wrong with the Concept2 sync"
@@ -200,7 +203,7 @@ def do_sync(w,options):
message,id = stravastuff.workout_strava_upload(
w.user.user,w
)
except StravaNoTokenError:
except stravastuff.StravaNoTokenError:
id = 0
message = "Please connect to Strava first"
@@ -210,7 +213,7 @@ def do_sync(w,options):
message,id = sporttracksstuff.workout_sporttracks_upload(
w.user.user,w
)
except SportTracksNoTokenError:
except sporttracksstuff.SportTracksNoTokenError:
message = "Please connect to SportTracks first"
id = 0
@@ -220,7 +223,7 @@ def do_sync(w,options):
message,id = runkeeperstuff.workout_runkeeper_upload(
w.user.user,w
)
except RunKeeperNoTokenError:
except runkeeperstuff.RunKeeperNoTokenError:
message = "Please connect to Runkeeper first"
id = 0
@@ -229,7 +232,7 @@ def do_sync(w,options):
message,id = underarmourstuff.workout_ua_upload(
w.user.user,w
)
except UnderArmourNoTokenError:
except underarmourstuff.UnderArmourNoTokenError:
message = "Please connect to MapMyFitness first"
id = 0
@@ -239,7 +242,7 @@ def do_sync(w,options):
message,id = tpstuff.workout_tp_upload(
w.user.user,w
)
except TPNoTokenError:
except tpstuff.TPNoTokenError:
message = "Please connect to TrainingPeaks first"
id = 0