Opened 8 years ago
Closed 8 years ago
#13148 closed defect (fixed)
Handle custom fields without valid default value
Reported by: | Miklos Molnar | Owned by: | Jon Ashley |
---|---|---|---|
Priority: | normal | Component: | KeepInterfaceSimplePlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
If you have a custom field without valid default value (in ex. start_date = time and start_date.value = ), the warden will return with error message ("No field named '%s' is defined"). I suggest that, for these fields we should return an empty string so it still can be used at comparisons in conditions. I have attached a patch for fixing the problem.
Attachments (1)
Change History (5)
Changed 8 years ago by
Attachment: | handle_custom_fields.diff added |
---|
comment:1 Changed 8 years ago by
Thank you for reporting this fault.
I tried to reproduce the issue and initially failed. I defined a custom field in trac.ini as follows:
[ticket-custom] bug_test = text bug_test.format = plain bug_test.label = Bug Test bug_test.options = bug_test.order = 7 bug_test.value =
and a Warden rule to reject the field:
[kis_warden] test for bug = bug_test == ''
but that simply triggers the Warden rejection as expected. The call to self.ticket.get_value_or_default('bug_test')
returned an empty string.
However, when I changed
bug_test = text
to
bug_test = time
that triggered the fault you reported. The call to self.ticket.get_value_or_default('bug_test')
returned None.
I wasn't even aware that there was a custom field type named 'time'! It doesn't show up as an option on my 'Manage Custom Fields' admin panel.
Further testing revealed that radio button fields suffer from the same problem - they start off undefined.
I will apply your patch, with a minor re-ordering so that the existing field list is only obtained when no value can be read from the field.
comment:3 Changed 8 years ago by
Status: | new → accepted |
---|
Believed fixed on trunk; will be fixed in the next release.
Patch for improved custom field handling