[Asterisk-code-review] realtime converter: Properly handle multiple values for the ... (testsuite[master])

Joshua Colp asteriskteam at digium.com
Thu Aug 4 07:36:32 CDT 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/3414

Change subject: realtime_converter: Properly handle multiple values for the same option.
......................................................................

realtime_converter: Properly handle multiple values for the same option.

Given the following:
allow=ulaw
allow=g722

The code would currently only insert the first entry for allow into
the database resulting in only ulaw being allowed.

This change fixes this by using the realtime method of separating
multiple values for the same option using ";" allowing both ulaw
and g722 to be allowed.

This is done in the realtime converter itself so this logic will
apply to any multiple values for the same option usage.

Change-Id: I5137be7947a9ad0a2856876222838b8e6cc1feaf
---
M lib/python/asterisk/realtime_converter.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/14/3414/1

diff --git a/lib/python/asterisk/realtime_converter.py b/lib/python/asterisk/realtime_converter.py
index 4688f61..ca7e688 100644
--- a/lib/python/asterisk/realtime_converter.py
+++ b/lib/python/asterisk/realtime_converter.py
@@ -155,7 +155,7 @@
                 vals = {'id': title}
                 for key in section.keys():
                     if key != 'type':
-                        vals[key] = section.get(key)[0].replace(";", "^3B")
+                        vals[key] = ";".join(value.replace(";", "^3B") for value in section.get(key))
 
                 conn.execute(table.insert().values(**vals))
 

-- 
To view, visit https://gerrit.asterisk.org/3414
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5137be7947a9ad0a2856876222838b8e6cc1feaf
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list