0001-formdata-add-a-varnames_only-variant-to-get_dict_wit.patch
wcs/formdata.py | ||
---|---|---|
30 | 30 |
from roles import Role |
31 | 31 | |
32 | 32 | |
33 |
def get_dict_with_varnames(fields, data, formdata=None): |
|
33 |
def get_dict_with_varnames(fields, data, formdata=None, varnames_only=False):
|
|
34 | 34 |
new_data = {} |
35 | 35 |
for field in fields: |
36 | 36 |
if not hasattr(field, 'get_view_value'): |
... | ... | |
43 | 43 |
else: |
44 | 44 |
value = '' |
45 | 45 |
display_value = '' |
46 |
# add it as f$n$ |
|
47 |
new_data['f%s' % field.id] = value |
|
48 | 46 | |
49 |
# also add it as 'field_' + normalized(field label) |
|
50 |
identifier_name = qommon.misc.simplify(field.label, space = '_') |
|
51 |
new_data['field_' + identifier_name] = value |
|
47 |
if not varnames_only: |
|
48 |
# add it as f$n$ |
|
49 |
new_data['f%s' % field.id] = value |
|
50 | ||
51 |
# also add it as 'field_' + normalized(field label) |
|
52 |
identifier_name = qommon.misc.simplify(field.label, space = '_') |
|
53 |
new_data['field_' + identifier_name] = value |
|
52 | 54 | |
53 | 55 |
# and finally add it as its manually defined variable name |
54 | 56 |
if field.varname: |
55 |
- |