Skip to content

Commit

Permalink
Prevent poorly formed URLs from breaking the __setitem__
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Tyler Ballance committed Jan 4, 2010
1 parent 0423fc0 commit d705f85
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions postgres2redis.py
Expand Up @@ -5,6 +5,7 @@
import psycopg2
import redis
import time
import urllib


def main():
Expand All @@ -27,6 +28,7 @@ def main():
# Forward mapping
rconn[enc] = json.dumps({'url' : url, 'rurl' : rurl, 'created' : created, 'flags' : flags})
# Reverse mapping
url = urllib.quote_plus(url)
rconn[url] = enc
finally:
conn.close()
Expand Down

0 comments on commit d705f85

Please sign in to comment.