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.

Reply via email to