]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blobdiff - wradmin/controllers/wrgpxtool.py
Files after running 2to3.py.
[philipp/winterrodeln/wradmin.git] / wradmin / controllers / wrgpxtool.py
index c98ff6c5b315abe544f3a6a53211daad1eaf2b19..6a2a1dce4b97ac83d284cfc988dc05429abe9c2e 100644 (file)
@@ -22,7 +22,7 @@ class WrgpxtoolController(BaseController):
     @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)            
@@ -30,18 +30,18 @@ class WrgpxtoolController(BaseController):
                 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')
     
@@ -49,7 +49,7 @@ class WrgpxtoolController(BaseController):
     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