[PyQt] setValue of QSettings adds undesired whitespaces in
hpj at urpla.net
Mon Jun 29 11:05:00 BST 2009
Am Montag, 29. Juni 2009 schrieb Luca Fasano:
> Hi all,
> As described in mail subject, I noticed that if you use setValue()
> method of a Qsettings object, undesired whitespaces are added to
> settings file. For example if you have an entry consisting of a comma
> separated list, whitespaces are added in it, even if setValue() only
> adds a *new* group.
> This is not a trivial bug if you want to use the same file for both
> QSettings and logging configuration. In fact logging.config.fileConfig()
> method does not recognize comma separated lists with whitespaces.
Hmm, putting it bluntly: your concept of relying on two different parsers
(with different behavior) handling some arbitrary ini file format is
flawed. I wouldn't even call this a bug. It's simply unpredictable
behavior. If you really want predictable behavior, get rid off one of them.
Since logging needs only a few parameter, why don't you fetch them via
QSetting and pass them on to your logging setup. And because logging has a
somewhat strange idea of log levels, you have a good chance of translating
them for human consumption (or even adjustment).
We could then migrate this discussion to the more general one:
- best practices in handling config data, default values, etc.
More information about the PyQt