Cleaned up directoryparam support

This commit is contained in:
Robohash 2012-11-06 17:37:39 -05:00
parent ab353e655c
commit 9df3e5c027
3 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
PIL==1.1.7
distribute==0.6.27
tornado==2.4
tornado==1.2.1
wsgiref==0.1.2

View File

@ -547,6 +547,7 @@ src="//static1.robohash.org/static/img/indented_star.png" width="27" height="25"
For example: http://robohash.org/colin@robohash.org?gravatar=yes<br> or http://robohash.org/620050a4db5104bae758cd75171d64ca?gravatar=hashed
</p><p>
<p>Both traditional and new Stealthy (https) robots are available.</p>
<p>We've also conditioned our robots to accept commands either via params or directories-<br> For instance http://127.0.0.1:8080/set_set3/bgset_bg1/3.14159?size=500x500
<p>Finally, the <a href="http://github.com/e1ven/Robohash">Blueprints are available</a> to build your own robotic
factory.</p>
</p>

View File

@ -230,16 +230,16 @@ class ImgHandler(tornado.web.RequestHandler):
args[k] = args[k][0]
else:
args[k] = ""
# IF, and Only IF, there is an arg in the list, should we interpret slashes as params
split = string.split('/')
if len(split) > 0:
string = split[0]
if len(split) > 1:
for str in split[1::]:
for str in split:
b = str.encode('ascii','ignore').split('_')
if len(b) == 2:
args[b[0]] = b[1]
if b[0] in ['gravatar','ignoreext','size','set','bgset']:
args[b[0]] = b[1]
string = split[len(split)-1]
colors = ['blue','brown','green','grey','orange','pink','purple','red','white','yellow']
sets = ['set1','set2','set3']