I have plugin enabled in components section of trac.ini
[components] dynfields.* = enabled I also verify this plugin enabled by going to Admin tab and under plugins I saw all components of this plugin checked. >From what you told me that will address what I need but whatever reason I >didn’t see one field changed to Yes when the other field selected Yes. I’ll keep looking to see what went wrong. Thanks. Canh From: [email protected] [mailto:[email protected]] On Behalf Of Rob Guttman Sent: Tuesday, June 19, 2012 11:58 AM To: [email protected] Subject: Re: [Trac] Re: One custom field change affecting another custom field Is the plugin meant to work that way ? Yes, although not exactly as described. my_cust_field1 should dynamically change to Yes the moment you change my_cust_field2's value to Yes (i.e., not on submit but dynamically on field value change - hence the plugin's name Dynamic Fields). The trac.ini spec I emailed you earlier works for me in this way. (Did you remember to enable the plugin in the components section?) If you need to ensure that my_cust_field2 is always Yes whenever my_cust_field1 is Yes, then you'll need to add some kind of field/form validation. Dynamic Fields provides rudimentary ticket field validation but you could use other plugins as well that may meet your need better. The number of underscores used for custom field names should not matter - use as many as you want. - Rob On Jun 19, 2012, at 10:14 AM, TRAN, CANH T PW wrote: 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. -- 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.
