<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Am 09.01.2011 21:43, schrieb Thomas L. Shinnick:
<blockquote
cite="mid:E7.63.14011.6FD1A2D4@hrndva-omtalb.mail.rr.com"
type="cite">
Having (possibly) surveyed all the available pypi config file
modules, I
still haven't seen one that allows an obvious and familiar
extension of
the strict Windows INI format. <br>
<br>
Each INI-style config module seems to enforce the strict rule:
each
option in a section must have a different name - no duplicates.
Thus it is impossible to have a simple list, e.g.<br>
<br>
<tt> [pathset uk]<br>
pathpair:
/bath/*
to /london/*<br>
pathpair:
/bath/upload/**
to /london/*<br>
pathpair:
/firth/*
to /forth/*<br>
pathpair:
/firth/upload/**
to /forth/*<br>
<br>
</tt>Rather you must give each line a separate name, e.g. <br>
<br>
<tt> [pathset uk]<br>
pathpair001:
/bath/*
to /london/*<br>
pathpair002:
/bath/upload/**
to /london/*<br>
pathpair003:
/firth/*
to /forth/*<br>
pathpair004:
/firth/upload/**
to /forth/*<br>
| |
| |
| |<br>
pathpair068:
/glasgow/*
to /edinburgh/*<br>
pathpair069:
/glasgow/upload/**
to /edinburgh/*<br>
| |
| |
| |<br>
<br>
</tt>This is not ideal for a number of reasons. Do you know of a
library module that has the (optional?) ability to handle
duplicate-named
options, returning them as a list?<br>
<br>
If instead someone can point me to a reasonable Apache-style
config
module, that might also serve. I've looked for such and the few
found seemed to be either bare bones or clumsily stripped out of
something much larger.<br>
<br>
<br>
<x-sigsep>
<p>
-- <br>
I'm a pessimist about probabilities; I'm an optimist about
possibilities.<br>
Lewis Mumford (1895-1990) <br>
</p>
</x-sigsep></blockquote>
I've let ini style files alone some time ago.<br>
Whenever possible I use JSON based files.<br>
<br>
Your example could then look like this:<br>
<br>
{<br>
"pathpairs":{<br>
"uk":[<br>
<tt>["/bath/*","/london/*"],<br>
["/bath/upload/**","/london/*"],<br>
["/firth/*,"/forth/*"],<br>
["/firth/upload/**","/forth/*"]<br>
]<br>
}<br>
}<br>
<br>
Since Python 2.7, json is in the standard library.<br>
</tt>
</body>
</html>