Example #1
0
def bexclude(form, excluded):
    """Return a list of all the fields in the given form, except those excluded."""
    excluded = set(split_fields(excluded))
    return [form[f] for f in form.fields if f not in excluded]
Example #2
0
def bfilter(form, fields):
    """Return only the given fields from the given form (as a list)."""
    return [form[f] for f in split_fields(fields)]
Example #3
0
def bexclude(form, excluded):
    """Return a list of all the fields in the given form, except those excluded."""
    excluded = set(split_fields(excluded))
    return [form[f] for f in form.fields if f not in excluded]
Example #4
0
 def test_split_fields(self):
     tests = ['foo bar baz', 'foo,bar,baz', ('foo', 'bar', 'baz')]
     for f in tests:
         self.assertEqual(split_fields(f), ['foo', 'bar', 'baz'])
Example #5
0
def bfilter(form, fields):
    """Return only the given fields from the given form (as a list)."""
    return [form[f] for f in split_fields(fields)]