fixfix splitline + opts weirdness default tip
authorTero Marttila <terom@fixme.fi>
Mon, 26 Nov 2012 15:19:26 +0200
changeset 21 945f5a8cfefb
parent 20 3feaac71738a
fixfix splitline + opts weirdness
index.py
--- a/index.py	Tue May 05 22:22:00 2009 +0300
+++ b/index.py	Mon Nov 26 15:19:26 2012 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.5
+#!/usr/bin/python
 # Copyright 2009 Tero Marttila
 #
 #   This program is free software: you can redistribute it and/or modify
@@ -387,7 +387,7 @@
                         return None
 
                     else :
-                        return l[0].split('\r\n')
+                        return l[0].splitlines() # ('\r\n')
 
                 else :
                     return l
@@ -532,9 +532,14 @@
 
     # build query string of req things
     qargs = [
-        (opt.name, opt.build_list(val)) for opt, val in (
-            (options.options_by_name[opt_name], val) for opt_name, val in opts.iteritems()
-        ) if val != opt.default
+        # XXX: eek, this is weird
+        (opt.name, val)
+            for opt, vals in (
+                (options.options_by_name[opt_name], vals) for opt_name, vals in opts.iteritems()
+            ) if vals != opt.default
+
+            # unpack (a, [b, c]) -> (a, b), (a, c)
+            for val in opt.build_list(vals)
     ]
 
     img_url = req.url_root + "logo" + ("?%s" % werkzeug.url_encode(qargs) if qargs else '')
@@ -619,7 +624,7 @@
         return handle_tile(req)
 
     else :
-        raise ValueError(req)
+        raise ValueError(req.path)
 
 @werkzeug.Request.application
 def wsgi_application (request) :