@restrict('POST')
def upload(self):
gpxfile = request.POST['gpxfile']
- if gpxfile != u'':
+ if gpxfile != '':
try:
set_lang('de')
(gpx, hints) = parse_wrgpx(string = gpxfile.value)
c.validation_hints = hints
c.validation_ok = len([hint for hint in hints if hint.level > 1]) == 0
session['wrgpx'] = gpx
- if c.validation_ok: session['flash'] = u"Die Datei '%s' ist eine gültige GPX 1.1 Datei und entspricht zusätzlich den Winterrodeln Anforderungen (WRGPX). :-)" % gpxfile.filename
- else: session['flash'] = u" Die Datei '%s' ist zwar eine gültige GPX 1.1 Datei, entspricht aber nicht den zusätzlichen Winterrodeln-Anforderungen. :-(" % gpxfile.filename
- except etree.XMLSyntaxError, e:
+ if c.validation_ok: session['flash'] = "Die Datei '%s' ist eine gültige GPX 1.1 Datei und entspricht zusätzlich den Winterrodeln Anforderungen (WRGPX). :-)" % gpxfile.filename
+ else: session['flash'] = " Die Datei '%s' ist zwar eine gültige GPX 1.1 Datei, entspricht aber nicht den zusätzlichen Winterrodeln-Anforderungen. :-(" % gpxfile.filename
+ except etree.XMLSyntaxError as e:
c.validation_exception = e
c.validation_hints = []
c.validation_ok = False
- session['flash'] = u"Die Datei '%s' ist keine gültige GPX 1.1 Datei. :-(" % gpxfile.filename
+ session['flash'] = "Die Datei '%s' ist keine gültige GPX 1.1 Datei. :-(" % gpxfile.filename
c.validated = True
c.filename = gpxfile.filename
else:
c.validated = False
- session['flash'] = u"Bitte eine GPX-Datei angeben!"
+ session['flash'] = "Bitte eine GPX-Datei angeben!"
session.save()
return render('wrgpxtool.html')
def height_profile(self):
response.content_type = 'image/png'
response.charset = None
- if session.has_key('wrgpx'):
+ if 'wrgpx' in session:
wrgpx = session['wrgpx']
s = height_profile(wrgpx)
return s