Re: SafeConfigParser can set unsafe values
- From: Matimus <mccredie@xxxxxxxxx>
- Date: Wed, 11 Jul 2007 05:20:52 -0000
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 = SafeConfigParser()
cp.add_section("sect")
cp.set("sect","opt","hello%world")
cp.write(sys.stdout)
[/code]
Produces this output:
[sect]
opt = hello%world
The write method never calls get. However, when you read the file that
was output by the above code using .get(...) will raise an error. You
can avoid that error by setting the optional 'raw' parameter to True.
.
- Follow-Ups:
- Re: SafeConfigParser can set unsafe values
- From: Hamish Moffatt
- Re: SafeConfigParser can set unsafe values
- References:
- SafeConfigParser can set unsafe values
- From: Hamish Moffatt
- Re: SafeConfigParser can set unsafe values
- From: Matimus
- Re: SafeConfigParser can set unsafe values
- From: Hamish Moffatt
- SafeConfigParser can set unsafe values
- Prev by Date: Re: bool behavior in Python 3000?
- Next by Date: Re: stripping the first byte from a binary file
- Previous by thread: Re: SafeConfigParser can set unsafe values
- Next by thread: Re: SafeConfigParser can set unsafe values
- Index(es):
Relevant Pages
|