Rob,
Thanks for prompt response. Hmm, I haven’t got it working. Let’s see if we both are on the same page. I have 2 dropdown fields (my_cust_field1 & my_cust_field2). My actual fields have up to 3 underscores. Ticket had my_cust_field1 as No and my_cust_field2 as No selected by default. I then selected my_cust_field2 as Yes. My goal is to have my_cust_field1 as Yes selected automatically once I submitted. Is the plugin meant to work that way ? Canh From: [email protected] [mailto:[email protected]] On Behalf Of Rob Guttman Sent: Monday, June 18, 2012 10:09 PM To: [email protected] Subject: Re: [Trac] Re: One custom field change affecting another custom field Canh, I implemented my suggestion and it seems to be working: http://trac-hacks.org/changeset/11655 Download latest 0.11 version (*not* the 0.12 version) and let me know how it works for you. Note you still need the "(overwrite)" directive - i.e., your trac.ini should look like this: [ticket-custom] cust_field1 = select cust_field1.label = "Field # 1" cust_field1.options = Yes | No cust_field1.value = No cust_field1.set_to_Yes_when_cust_field2 = Yes (overwrite) cust_field2 = select cust_field2.label = "Field # 2" cust_field2.options = Yes | No cust_field2.value = No - Rob On Jun 18, 2012, at 12:04 PM, TRAN, CANH T PW wrote: Rob, Handling Trac issue is a very small part of my job. I’m also off from work 1 week starting Wed so not sure to have time working on it. Thanks for all the info. Canh From: [email protected] [mailto:[email protected]] On Behalf Of Rob Guttman Sent: Monday, June 18, 2012 11:31 AM To: [email protected] Subject: Re: [Trac] Re: One custom field change affecting another custom field Canh, there's a way to make ini config file parsing to be case sensitive using optionxform: http://docs.python.org/library/configparser.html#ConfigParser.RawConfigParser.optionxform If you don't patch Trac's config.py module directly (not recommended if it can be avoided), I would suggest looking at dynfield's options.py module. You may be able to update Options.__init__() to use the above optionxform directive. I don't have time right now to look into doing this myself but let me know if it works for you or if you run into trouble. I may have time this coming weekend to spend some time on it. - Rob On Jun 18, 2012, at 9:26 AM, TRAN, CANH T PW wrote: Hi Rob, Thanks for looking into this. I really need to keep the option Yes or No as it is without converting everything to lowercase. My ticket workflow is quite complex. I also use Ticket Validator plugin. Everything works ok with the way it is. If you don’t plan to do new release accommodating this, please tell me where to change in your source. Maybe I can tweak for my case. I know enough Python to do pattern search to look for Yes or yes. Thanks. Canh From: [email protected] [mailto:[email protected]] On Behalf Of Rob Guttman Sent: Friday, June 15, 2012 6:50 PM To: [email protected] Subject: Re: [Trac] Re: One custom field change affecting another custom field Canh, apologies for not responding sooner - been one of those weeks. There are two problems with your config; 1. You can only user lowercase for ini file options - so this rule: cust_field1.set_to_Yes_when_cust_field2 = Yes needs to change to: cust_field1.set_to_yes_when_cust_field2 = yes That obviously has implications for our custom field option values. This is a limitation in standard ini files and therefore this plugin. If you can live with lowercase "yes" and "no" then proceed to issue #2. :) 2. You need to append "(overwrite)" to the rule if you want to overwrite non-empty values. So your overall config should look like this: [ticket-custom] cust_field1 = select cust_field1.label = "Field # 1" cust_field1.options = yes | no cust_field1.value = no cust_field1.set_to_yes_when_cust_field2 = yes (overwrite) cust_field2 = select cust_field2.label = "Field # 2" cust_field2.options = yes|no cust_field2.value = no I've tested above and it works for me. Cheers. - Rob PS: Thanks to Reinhard and Ryan for your assistance. On Jun 15, 2012, at 3:37 PM, RjOllos wrote: On Friday, June 15, 2012 9:22:00 AM UTC-7, TRAN, CANH T PW wrote: Since the system was deployed in production for some time, renaming the internal field names will affect older tickets saved in trac.db. I prefer not to rename. If the DynamicFieldsPlugin has parse issue with underscore, I will see if I know how to tweak its source. You could open a ticket (1) for this; Rob is usually very responsive. It would suggest that the issue should at least be documented on the project page, since underscores in trac.ini field names are very common in my experience. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/trac-users/-/3eyCunpcbDIJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.
