Warning: Tickets must contain a summary.
[fieldscheck]
type = str
component = str
[ticketvalidator]
new.required = type,component
Say I want to use the Ticket Validator plugin, and I want to test the Component and Type fields for specific values. Is this the correct format to enter the field names in the .ini? I'm totally guessing on the 'str' part here:
[fieldscheck]
type = str
component = str
And does this look right for the next section?
[ticketvalidator]
new.required = type,component
I'm not sure which plugin the [fieldscheck] section applies to. It isn't defined by TicketValidatorPlugin:
# trac-admin /var/www/projects/svn-OurProject ticket_type list
Possible Values
-----------------------------
--- Please choose a state ---
01 Alabama
04 Arizona
05 Arkansas
06 California
08 Colorado
...
As for using it with your custom field, I can confirm the following works:[ticket-custom]the_custom = selectthe_custom.options = |one|two|thr|fou[ticketvalidator]new.required = the_custom
I was trying to incorporate the changes made by Dan Winslow in this comment. The end-goal is to trigger the error when the field hasn't been moved from the default value. The fields are pre-populated with a dropdown list...So we'd like to query to be sure the user moved the default from "--- Please choose a state ---"
field_name_alias = {}
for field_name_temp in required_fields:
if (field_name_temp == "type"):
field_name_alias[field_name_temp] = "State"
elif field_name_temp == "component":
field_name_alias[field_name_temp] = "Table"
else:
field_name_alias[field_name_temp] = field_name_temp
errors = [(field_name_alias[field_name], '%s is required' % field_name_alias[field_name])
for field_name in required_fields
if (not ticket[field_name]) or (ticket[field_name] == '--- Please choose a state ---') or (ticket[field_name] == '--- Please select a table ---')]
return errors
[ticketvalidator]
new.required = type,component
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12.04.2015 22:52, RjOllos wrote:
> Another approach would be to have TicketValidatorPlugin add a label on
> an empty field, and an empty field in the case that the field doesn't
> allow the empty value. This would avoid creating dummy values like your
> Component "--- Please choose a state ---"
Nice idea. I've often seen trailing (red) star behind a required input
field label as visual sign for required input. If others agree, that
this is sufficiently common, it could become a Trac default visual style
too.
Steffen Hoffmann