Commit 12a4e8aa authored by cathi's avatar cathi

Fixed a problem in the default insertion code.

parent a9e1db84
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.16 $'[11:-2] __version__='$Revision: 1.17 $'[11:-2]
import regex, sys, os, string import regex, sys, os, string
from string import lower, atoi, rfind, split, strip, join, upper, find from string import lower, atoi, rfind, split, strip, join, upper, find
...@@ -424,10 +424,11 @@ class HTTPRequest(BaseRequest): ...@@ -424,10 +424,11 @@ class HTTPRequest(BaseRequest):
if defaults: if defaults:
for keys, values in defaults.items(): for keys, values in defaults.items():
if not form.has_key(keys): if not form.has_key(keys):
# if the form does not have the key and the # if the form does not have the key,
# form is not empty, set the default # set the default
form[keys]=values form[keys]=values
else: else:
#The form has the key
if getattr(values, '__class__',0) is record: if getattr(values, '__class__',0) is record:
# if the key is mapped to a record, get the # if the key is mapped to a record, get the
# record # record
...@@ -440,7 +441,7 @@ class HTTPRequest(BaseRequest): ...@@ -440,7 +441,7 @@ class HTTPRequest(BaseRequest):
# the attribute, set it to the default # the attribute, set it to the default
setattr(r,k,v) setattr(r,k,v)
form[keys] = r form[keys] = r
else: elif values == type([]):
# the key is mapped to a list # the key is mapped to a list
l = form[keys] l = form[keys]
for x in values: for x in values:
...@@ -461,6 +462,10 @@ class HTTPRequest(BaseRequest): ...@@ -461,6 +462,10 @@ class HTTPRequest(BaseRequest):
if not a in l: if not a in l:
l.append(a) l.append(a)
form[keys] = l form[keys] = l
else:
# The form has the key, the key is not mapped
# to a record or sequence so do nothing
pass
# Convert to tuples # Convert to tuples
if tuple_items: if tuple_items:
......
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