Re: SafeConfigParser can set unsafe values

2007-07-11 Thread Hamish Moffatt
Matimus wrote: >> I agree, but that was a trivial example to demonstrate the problem. >> Writing the file out to disk writes it exactly as set(), causing a get() >> to fail just the same later. > > No... The above statement is not true. Yes, it is. Whatever you set gets written out directly. Your

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Matimus
> This not only happens when get() after a set(), but with all the use cases > above. An intervening write()/read() does not change things. > But I'm not sure it is a bug really. If all % were escaped automatically, > there is no way to write a templatized value. Maybe SafeConfigParser.set > should

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Matimus
> This not only happens when get() after a set(), but with all the use cases > above. An intervening write()/read() does not change things. > But I'm not sure it is a bug really. If all % were escaped automatically, > there is no way to write a templatized value. Maybe SafeConfigParser.set > should

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Matimus
> I agree, but that was a trivial example to demonstrate the problem. > Writing the file out to disk writes it exactly as set(), causing a get() > to fail just the same later. No... The above statement is not true. The following code: [code] from ConfigParser import * import sys cp = SafeConfig

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Hamish Moffatt
Matimus wrote: >> Should SafeConfigParser.set() be escaping automatically? > > It seems like that would be a nice feature. However, may I offer up > that if you are setting an option and then later on getting that value > back in the same program, you probably should have used some other > storage

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Gabriel Genellina
En Tue, 10 Jul 2007 20:53:51 -0300, Matimus <[EMAIL PROTECTED]> escribió: >> Should SafeConfigParser.set() be escaping automatically? > > It seems like that would be a nice feature. However, may I offer up > that if you are setting an option and then later on getting that value > back in the same

Re: SafeConfigParser can set unsafe values

2007-07-10 Thread Matimus
> Should SafeConfigParser.set() be escaping automatically? It seems like that would be a nice feature. However, may I offer up that if you are setting an option and then later on getting that value back in the same program, you probably should have used some other storage mechanism in the first pl

SafeConfigParser can set unsafe values

2007-07-10 Thread Hamish Moffatt
SafeConfigParser is supposed to be safer than ConfigParser, but calling set with a string value containing '%' generates exceptions when you get() it back. Python 2.5.1 (r251:54863, Apr 25 2007, 21:31:46) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "cr