summaryrefslogtreecommitdiff
path: root/kombu
diff options
context:
space:
mode:
authorTomasz Niedziela-Brach <niedziela.brach@gmail.com>2021-04-04 17:02:03 +0200
committerGitHub <noreply@github.com>2021-04-04 18:02:03 +0300
commit44dcc33a74bfb497ace1071d9d4b9851fa04f561 (patch)
treeaf829a61d52e918d8c90c56d3b9f624f57ded62a /kombu
parent78cc97b549e3b58005747ecb3d160f2b60ba63ba (diff)
downloadkombu-44dcc33a74bfb497ace1071d9d4b9851fa04f561.tar.gz
Azure Service Bus - versatile queue names fix (#1324)
* fixed character replace table according to the comment above - dots replaced by dashes, other punctuations replaced by underscores * optimised with precalculated punctuation set - according to @thedrow suggestion * queue name tests * cleanup
Diffstat (limited to 'kombu')
-rw-r--r--kombu/transport/azureservicebus.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kombu/transport/azureservicebus.py b/kombu/transport/azureservicebus.py
index 74a5cd17..331d0038 100644
--- a/kombu/transport/azureservicebus.py
+++ b/kombu/transport/azureservicebus.py
@@ -66,8 +66,10 @@ from azure.servicebus.management import ServiceBusAdministrationClient
from . import virtual
# dots are replaced by dash, all other punctuation replaced by underscore.
+PUNCTUATIONS_TO_REPLACE = set(string.punctuation) - {'_', '.', '-'}
CHARS_REPLACE_TABLE = {
- ord(c): 0x5f for c in string.punctuation if c not in '_'
+ ord('.'): ord('-'),
+ **{ord(c): ord('_') for c in PUNCTUATIONS_TO_REPLACE}
}