Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsagi <sagi@users.noreply.github.com>2015-12-11 12:29:02 +0300
committersagi <sagi@users.noreply.github.com>2015-12-11 12:29:02 +0300
commit681de292b7878b4d60acd8ffbef59be59bf6520c (patch)
tree12d5bfb4c9eb329d6e47ef048ebad8ef9f8ac104 /letsencrypt-apache
parentc594a258feb1333300607308bc898019d4950608 (diff)
Switch to using defaultdict(list)
Diffstat (limited to 'letsencrypt-apache')
-rw-r--r--letsencrypt-apache/letsencrypt_apache/configurator.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py
index bc12a75fe..6b4a0e46e 100644
--- a/letsencrypt-apache/letsencrypt_apache/configurator.py
+++ b/letsencrypt-apache/letsencrypt_apache/configurator.py
@@ -25,6 +25,7 @@ from letsencrypt_apache import tls_sni_01
from letsencrypt_apache import obj
from letsencrypt_apache import parser
+from collections import defaultdict
logger = logging.getLogger(__name__)
@@ -930,16 +931,13 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
rewrite_path = self.parser.find_dir(
"RewriteRule", None, start=vhost.path)
- dir_dict = {}
+ dir_dict = defaultdict(list)
pat = r'.*(directive\[\d+\]).*'
for match in rewrite_path:
m = re.match(pat, match)
if m:
dir_id = m.group(1)
- if dir_id in dir_dict:
- dir_dict[dir_id].append(match)
- else:
- dir_dict[dir_id] = [match]
+ dir_dict[dir_id].append(match)
if dir_dict:
for dir_id in dir_dict: