Commit f718847e authored by Jim Fulton's avatar Jim Fulton

Fixed indentation problem in a bunch of new code.

parent 3d742d26
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.11 $'[11:-2] __version__='$Revision: 1.12 $'[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
...@@ -392,87 +392,87 @@ class HTTPRequest(BaseRequest): ...@@ -392,87 +392,87 @@ class HTTPRequest(BaseRequest):
if seqf: item=[item] if seqf: item=[item]
mapping_object[key]=item mapping_object[key]=item
#insert defaults into form dictionary #insert defaults into form dictionary
for keys, values in defaults.items(): for keys, values in defaults.items():
if not form.has_key(keys) and not form == {}: if not form.has_key(keys) and not form == {}:
# if the form does not have the key and the # if the form does not have the key and the
# form is not empty, set the default # form is not empty, set the default
form[keys]=values form[keys]=values
else: else:
# the form has the key # the form has the key
if not form == {}: if not form == {}:
if hasattr(values, '__class__') and values.__class__ is record: if hasattr(values, '__class__') and values.__class__ is record:
# if the key is mapped to a record, get the # if the key is mapped to a record, get the
# record # record
r = form[keys] r = form[keys]
for k, v in values.__dict__.items(): for k, v in values.__dict__.items():
# loop through the attributes and values # loop through the attributes and values
# in the default dictionary # in the default dictionary
if not hasattr(r, k): if not hasattr(r, k):
# if the form dictionary doesn't have # if the form dictionary doesn't have
# 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:
# the key is mapped to a list
l = form[keys]
for x in values:
# for each x in the list
if hasattr(x, '__class__') and x.__class__ is record:
# if the x is a record
for k, v in x.__dict__.items():
# loop through each attribute and value in the
# record
for y in l:
# loop through each record in the form list
# if it doesn't have the attributes in the
# default dictionary, set them
if not hasattr(y, k):
setattr(y, k, v)
else:
# x is not a record
if not a in l:
l.append(a)
form[keys] = l
# Convert to tuples
for key in tuple_items.keys():
# Split the key and get the attr
k=split(key, ".")
k,attr=join(k[:-1], "."), k[-1]
a = attr
# remove any type_names in the attr
while not a=='':
a=split(a, ":")
a,new=join(a[:-1], ":"), a[-1]
attr = new
if form.has_key(k):
# If the form has the split key get its value
item =form[k]
if hasattr(item, '__class__') and item.__class__ is record:
# if the value is mapped to a record, check if it
# has the attribute, if it has it, convert it to
# a tuple and set it
if hasattr(item,attr):
value=tuple(getattr(item,attr))
setattr(item,attr,value)
else: else:
# the key is mapped to a list # It is mapped to a list of records
l = form[keys] for x in item:
for x in values: # loop through the records
# for each x in the list if hasattr(x, attr):
if hasattr(x, '__class__') and x.__class__ is record: # If the record has the attribute
# if the x is a record # convert it to a tuple and set it
for k, v in x.__dict__.items(): value=tuple(getattr(x,attr))
# loop through each attribute and value in the setattr(x,attr,value)
# record else:
for y in l: # the form does not have the split key
# loop through each record in the form list if form.has_key(key):
# if it doesn't have the attributes in the # if it has the original key, get the item
# default dictionary, set them # convert it to a tuple
if not hasattr(y, k): item=form[key]
setattr(y, k, v) item=tuple(form[key])
else: form[key]=item
# x is not a record
if not a in l:
l.append(a)
form[keys] = l
# Convert to tuples
for key in tuple_items.keys():
# Split the key and get the attr
k=split(key, ".")
k,attr=join(k[:-1], "."), k[-1]
a = attr
# remove any type_names in the attr
while not a=='':
a=split(a, ":")
a,new=join(a[:-1], ":"), a[-1]
attr = new
if form.has_key(k):
# If the form has the split key get its value
item =form[k]
if hasattr(item, '__class__') and item.__class__ is record:
# if the value is mapped to a record, check if it
# has the attribute, if it has it, convert it to
# a tuple and set it
if hasattr(item,attr):
value=tuple(getattr(item,attr))
setattr(item,attr,value)
else:
# It is mapped to a list of records
for x in item:
# loop through the records
if hasattr(x, attr):
# If the record has the attribute
# convert it to a tuple and set it
value=tuple(getattr(x,attr))
setattr(x,attr,value)
else:
# the form does not have the split key
if form.has_key(key):
# if it has the original key, get the item
# convert it to a tuple
item=form[key]
item=tuple(form[key])
form[key]=item
other=self.other={} other=self.other={}
other.update(form) other.update(form)
......
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