Rev 6096: Create a single configobj for list conversions and just reset() it when needed. in file:///home/vila/src/bzr/experimental/expand-in-stack/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Sep 2 15:55:31 UTC 2011
At file:///home/vila/src/bzr/experimental/expand-in-stack/
------------------------------------------------------------
revno: 6096
revision-id: v.ladeuil+lp at free.fr-20110902155531-huf6yyv7r3874rlk
parent: v.ladeuil+lp at free.fr-20110902154210-p67n9k5sdkid5pge
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: expand-in-stack
timestamp: Fri 2011-09-02 17:55:31 +0200
message:
Create a single configobj for list conversions and just reset() it when needed.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-09-02 15:42:10 +0000
+++ b/bzrlib/config.py 2011-09-02 15:55:31 +0000
@@ -2421,17 +2421,19 @@
return int(unicode_str)
+# Use a an empty dict to initialize an empty configobj avoiding all
+# parsing and encoding checks
+_list_converter_config = configobj.ConfigObj({}, encoding='utf-8')
+
def list_from_store(unicode_str):
if not isinstance(unicode_str, basestring):
raise TypeError
- # Use a an empty dict to initialize an empty configobj avoiding all
- # parsing and encoding checks
- c = ConfigObj({}, encoding='utf-8')
# Now inject our string directly as unicode All callers got their value
# from configobj, so values that need to be quoted are already properly
# quoted.
- c._parse([u"list=%s" % (unicode_str,)])
- co_list_or_not = c['list']
+ _list_converter_config.reset()
+ _list_converter_config._parse([u"list=%s" % (unicode_str,)])
+ co_list_or_not = _list_converter_config['list']
# ConfigObj return '' instead of u''. Use 'str' below to catch all cases.
if isinstance(co_list_or_not, basestring):
if co_list_or_not:
More information about the bazaar-commits
mailing list