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

George Joseph asteriskteam at digium.com
Thu Oct 7 13:54:31 CDT 2021


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


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/72/16572/1

diff --git a/lib/python/asterisk/asterisk.py b/lib/python/asterisk/asterisk.py
index f1371db..ee31c5a 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/+/16572
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I16ec4dc84303ae3c3bdd1884959559675f6143c8
Gerrit-Change-Number: 16572
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/7a4ff6bf/attachment.html>


More information about the asterisk-code-review mailing list