Handle unicode values in config files

Registered by Andrew Garner

Options that use utf8 are just strings of bytes currently and will often not have the intended effect. Notably, using unicode in database filters for mysqldump will fail to match as the filter parameters as strings of bytes will not match the python unicode names.

There are a few issues in a couple plugins that expect to be able to **kwargs a config section. This notably breaks mysql_lvm which does the following in a couple places:

open_stream(..., **config['compression'])

I expect to find a few more places where unicode configs break things as well, but so far it's had a pretty minor impact and code like the following is easily cleaned up.

This is only a problem in this context because python2.5 and below doesn't allow unicode keywords via kwargs:

>>> def foo(**kwargs):
... pass
...
>>> foo(**{u'test' : 'bar' })
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: foo() keywords must be strings
This isn't an issue python2.6+ per:
http://bugs.python.org/issue2646

Blueprint information

Status:
Complete
Approver:
None
Priority:
Medium
Drafter:
None
Direction:
Approved
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Andrew Garner
Completed by
Andrew Garner

Related branches

Sprints

Whiteboard

This is implemented as of 1.0.5. Per the previous notes, in order to support **kwargs from an existing config on (c)python <= 2.5, keys are not allowed to be unicode strings. This is handled in the normalization phase when a ConfigObj is loaded by holland.core.

This does put the restriction that holland 1.0 (at least) does not support parameter names as unicode - but we do support unicode values. Even this restriction on keys/params can be lifted once we drop python2.4 support in the future.

No current configspecs have any need to suport unicode keys, but I suspect internationalization may be interesting to support in the future. This support does mean we can support specifying unicode database names in config files much more cleanly than before (for instance as mysqldump exclude/include filters).

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.