Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91051

Re: case-sensitive configparser without magical interpolation?

Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'that?': 0.05; '22,': 0.09; '2.7': 0.13; 'argument': 0.15; '10:59': 0.16; 'hacked': 0.16; 'method;': 0.16; 'overriding': 0.16; 'sign.': 0.16; 'subject:case': 0.16; 'written)': 0.16; 'wrote:': 0.16; 'later': 0.16; 'work,': 0.21; '3.2': 0.22; 'disable': 0.22; 'strict': 0.22; 'subject:skip:i 10': 0.22; 'am,': 0.23; '2015': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'fri,': 0.31; 'keyword': 0.31; 'option': 0.31; 'url:python': 0.33; 'subject:?': 0.34; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'but': 0.36; 'url:org': 0.36; '(and': 0.36; 'url:library': 0.36; 'should': 0.37; 'subject:: ': 0.37; 'is,': 0.38; 'does': 0.39; 'url:docs': 0.39; 'to:addr:python.org': 0.39; 'takes': 0.39; 'subject:-': 0.39; 'url:3': 0.60; 'percent': 0.66; 'url:4': 0.70; 'configparser': 0.84; 'to:name:python': 0.84; 'url:configparser': 0.84; 'magical': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=TUuxqtcpVT6+auypqUGYNg9etHw0xxHDNnNHgnzDxPo=; b=s7dmpm5xrNLWUgPbQ5LFh1uutw5P+whjTS5i/xO+C2BP2eMuVUTI4+0AS7n/C8zxg+ /AeH0ZhY+uqFCAbh/vvFz1SXB8oWy6/+1eJsldp3guSL4vsCbZbG6d5JNq26h++R5vaf xcXXPQm9cD2le5KKO4ACIdaWUFbtQQpglANvHeTRP+MRFoRGrIDRtCCNI0z2589KC3ih 8n4e0WLO3nxQvgJ5y/Ij2ofSbPKdP37JHKbt5S4e/YVsFZEfidzkiL6TKCqAyUaE8NT0 BPDMSdv7kSSE+5cCwFytIR8wI6jXf8eDrqOfcUzOoL0vMHfSY6/fd+i0gm5Q9OJFtRsR lHKw==
X-Received by 10.107.36.207 with SMTP id k198mr12309583iok.69.1432314773323; Fri, 22 May 2015 10:12:53 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <1d76eb69-7880-4a25-976c-96a69b61b91f@googlegroups.com>
References <1d76eb69-7880-4a25-976c-96a69b61b91f@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 22 May 2015 11:12:12 -0600
Subject Re: case-sensitive configparser without magical interpolation?
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.226.1432314781.17265.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432314781 news.xs4all.nl 2858 [2001:888:2000:d::a6]:42002
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4254
X-Received-Body-CRC 1106515514
Xref csiph.com comp.lang.python:91051

Show key headers only | View raw


On Fri, May 22, 2015 at 10:59 AM,  <georgeryoung@gmail.com> wrote:
> [python 2.7]
> I need to use a configparser that is case-sensitive for option names, but does not do magical interpolation of percent sign.
> I.e.:
>
> [Mapping0]
> backupHost = eng%26
> dbNode = v_br_node0001
>
> should be read (and later written) as is, including capitalization and the percent sign.
>
> I find that RawConfigParser keeps the %, but downcases the option name.
> And SafeConfigParser can be hacked with optionxform to be case-sensitive, but does interpolation.
> How can I get case-sensitive but no interpolation?

RawConfigParser also has the optionxform method; have you tried overriding that?

If that doesn't work, then how strict is the 2.7 requirement? In 3.2
or later, the ConfigParser takes an interpolation keyword argument
that can be used to disable interpolation:

https://docs.python.org/3.4/library/configparser.html#configparser-objects

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

case-sensitive configparser without magical interpolation? georgeryoung@gmail.com - 2015-05-22 09:59 -0700
  Re: case-sensitive configparser without magical interpolation? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-22 11:12 -0600
    Re: case-sensitive configparser without magical interpolation? georgeryoung@gmail.com - 2015-05-22 10:35 -0700

csiph-web