Do not accept -d first in the presence of multiple -w flags

* informal testing suggested that many people found this behaviour confusing
This commit is contained in:
Peter Eckersley
2015-11-30 18:15:07 -08:00
parent b3851edb73
commit 2b87d6f700
2 changed files with 15 additions and 4 deletions
+8
View File
@@ -1043,6 +1043,10 @@ def _plugins_parsing(helpful, plugins):
class WebrootPathProcessor(argparse.Action): # pylint: disable=missing-docstring
def __init__(self, *args, **kwargs):
self.domain_before_webroot = False
argparse.Action.__init__(self, *args, **kwargs)
def __call__(self, parser, config, webroot, option_string=None):
"""
Keep a record of --webroot-path / -w flags during processing, so that
@@ -1055,8 +1059,12 @@ class WebrootPathProcessor(argparse.Action): # pylint: disable=missing-docstring
# config.webroot_map are filled in by cli.DomainFlagProcessor
if config.domains:
config.webroot_map = dict([(d, webroot) for d in config.domains])
self.domain_before_webroot = True
else:
config.webroot_map = {}
elif self.domain_before_webroot:
raise errors.Error("If you specify multiple webroot paths, one of "
"them must precede all domain flags")
config.webroot_path.append(webroot)