def convert(self):
input = request.POST['input']
- no_elevation = request.POST.has_key('no_elevation')
- simplify = request.POST.has_key('simplify')
- swap_latlon = request.POST.has_key('swap_latlon')
- c.no_geoformat = request.POST.has_key('no_geoformat')
- c.no_gpxformat = request.POST.has_key('no_gpxformat')
- c.no_gmapsformat = request.POST.has_key('no_gmapsformat')
- c.no_geocachingformat = request.POST.has_key('no_geocachingformat')
+ no_elevation = 'no_elevation' in request.POST
+ simplify = 'simplify' in request.POST
+ swap_latlon = 'swap_latlon' in request.POST
+ c.no_geoformat = 'no_geoformat' in request.POST
+ c.no_gpxformat = 'no_gpxformat' in request.POST
+ c.no_gmapsformat = 'no_gmapsformat' in request.POST
+ c.no_geocachingformat = 'no_geocachingformat' in request.POST
if input is None or len(input.strip()) == 0:
c.result = None
geo = wrpylib.wrvalidators.MultiGeo()
try: c.result = geo.to_python(input)
- except formencode.Invalid, e:
- session['flash'] = unicode(e)
+ except formencode.Invalid as e:
+ session['flash'] = str(e)
session.save()
return redirect(url(controller='coordtool', action='index'))