From 7f7fa90c69781616ee448778e65336e368670452 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Wed, 1 Aug 2012 01:39:17 -0400
Subject: [PATCH 1/1] Update aksetup to preserve commas in StringListOption defaults.
---
aksetup_helper.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/aksetup_helper.py b/aksetup_helper.py
index cafdad6..12953df 100644
a
|
b
|
class StringListOption(Option): |
486 | 486 | if default is None: |
487 | 487 | return None |
488 | 488 | |
489 | | return ",".join([str(el) for el in default]) |
| 489 | return ",".join([str(el).replace(",", r"\,") for el in default]) |
490 | 490 | |
491 | 491 | def get_help(self, default): |
492 | 492 | return Option.get_help(self, default) + " (several ok)" |
… |
… |
class StringListOption(Option): |
497 | 497 | return None |
498 | 498 | else: |
499 | 499 | if opt: |
500 | | return opt.split(",") |
| 500 | import re |
| 501 | sep = re.compile(r"(?<!\\),") |
| 502 | result = sep.split(opt) |
| 503 | result = [i.replace(r"\,", ",") for i in result] |
| 504 | return result |
501 | 505 | else: |
502 | 506 | return [] |
503 | 507 | |