Commit 166d23ea authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Renamed library function parse_post_data to parse_data.

parent fe344780
......@@ -22,7 +22,7 @@ def application(environ, start_response):
# Grab user data, cut off non-relevant fields.
data = environ['wsgi.input']
data = library.parse_post_data( data )
data = library.parse_data( data )
# Store parsed user data in these handy variables.
short_url = data["short_url"]
......
......@@ -66,7 +66,7 @@ def application(environ, start_response):
# Grab user data, cut off non-relevant fields.
data = environ['wsgi.input']
data = library.parse_post_data( data )
data = library.parse_data( data )
# Store parsed user data in these handy variables.
long_url = data["long-url"]
......
......@@ -215,10 +215,10 @@ def connect_to_mysql():
# Parse post data submitted to this function. That is, split it up as a
# dictionary and return that readable dictionary.
def parse_post_data( post_data ):
def parse_data( datastring ):
delimiter = "&"
subdelimiter = "="
data = post_data.read()
data = datastring.read()
if len( data ) > 0:
# create a dictionary as {field:val, field:val, ... }
data = dict( item.split(subdelimiter) for item in data.split( delimiter ) )
......
......@@ -46,7 +46,7 @@ def application(environ, start_response):
# Grab user data, cut off non-relevant fields.
data = environ['wsgi.input']
data = library.parse_post_data( data )
data = library.parse_data( data )
# Determine the user credentials to authenticate.
usr = data['usr']
......
......@@ -46,7 +46,7 @@ def application(environ, start_response):
# Grab user data, cut off non-relevant fields.
data = environ['wsgi.input']
data = library.parse_post_data( data )
data = library.parse_data( data )
user = data['user'].strip().replace('+',' ').lower()
name = data['name'].strip().replace('+',' ')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment