[Asterisk-code-review] asterisk.py: Fix TypeError when replacing instanceid (testsuite[18])

George Joseph asteriskteam at digium.com
Thu Oct 7 14:02:25 CDT 2021


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/16592 )


Change subject: asterisk.py: Fix TypeError when replacing instanceid
......................................................................

asterisk.py: Fix TypeError when replacing instanceid

id = 23
value = "test <<instanceid>> test"
value.replace("<<instanceid>>", id) fails with a TypeError because
replace doesn't automatically convert the numeric replacement
argument to a string.

Now doing value.replace("<<instanceid>>", str(id))

ASTERISK-29675

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



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/92/16592/1

diff --git a/lib/python/asterisk/asterisk.py b/lib/python/asterisk/asterisk.py
index f1371db..08c4e9a 100644
--- a/lib/python/asterisk/asterisk.py
+++ b/lib/python/asterisk/asterisk.py
@@ -675,7 +675,7 @@
         for key in self.directories.keys():
             value = value.replace("<<%s>>" % key,
                               "%s%s" % (self.base, self.directories[key]))
-            value = value.replace("<<instanceid>>", self.instance_id)
+        value = value.replace("<<instanceid>>", str(self.instance_id))
         return value
 
 # Quick little function for doing search and replace in a file used below.

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/16592
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I16ec4dc84303ae3c3bdd1884959559675f6143c8
Gerrit-Change-Number: 16592
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211007/5e2f5330/attachment.html>


More information about the asterisk-code-review mailing list