Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
SvFormContentDict Class Reference
Inheritance diagram for SvFormContentDict:
FormContentDict UserDict InterpFormContentDict

Public Member Functions

def __getitem__
 
def getlist
 
def values
 
def items
 
- Public Member Functions inherited from FormContentDict
def __init__
 
- Public Member Functions inherited from UserDict
def __init__
 
def __repr__
 
def __cmp__
 
def __len__
 
def __getitem__
 
def __setitem__
 
def __delitem__
 
def clear
 
def copy
 
def keys
 
def items
 
def iteritems
 
def iterkeys
 
def itervalues
 
def values
 
def has_key
 
def update
 
def get
 
def setdefault
 
def popitem
 
def __contains__
 

Additional Inherited Members

- Data Fields inherited from FormContentDict
 dict
 
 data
 
 query_string
 

Detailed Description

Form content as dictionary expecting a single value per field.

If you only expect a single value for each field, then form[key]
will return that single value.  It will raise an IndexError if
that expectation is not true.  If you expect a field to have
possible multiple values, than you can use form.getlist(key) to
get all of the values.  values() and items() are a compromise:
they return single strings where there is a single value, and
lists of strings otherwise.

Definition at line 785 of file cgi.py.

Member Function Documentation

def __getitem__ (   self,
  key 
)

Definition at line 797 of file cgi.py.

References FormContentDict.dict.

798  def __getitem__(self, key):
799  if len(self.dict[key]) > 1:
800  raise IndexError, 'expecting a single value'
return self.dict[key][0]
def getlist (   self,
  key 
)

Definition at line 801 of file cgi.py.

References FormContentDict.dict.

802  def getlist(self, key):
return self.dict[key]
def items (   self)

Definition at line 810 of file cgi.py.

811  def items(self):
812  result = []
813  for key, value in self.dict.items():
814  if len(value) == 1:
815  result.append((key, value[0]))
816  else: result.append((key, value))
817  return result
818 
def values (   self)

Definition at line 803 of file cgi.py.

804  def values(self):
805  result = []
806  for value in self.dict.values():
807  if len(value) == 1:
808  result.append(value[0])
809  else: result.append(value)
return result

The documentation for this class was generated from the following file: