X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/c1b068b03a604652f3eb284fdb92bcb1171d9601..18000e3faf756cf32afc2b1bed562e6f43e593a4:/wizard/deploy.py diff --git a/wizard/deploy.py b/wizard/deploy.py index 27a1bb3..d559c79 100644 --- a/wizard/deploy.py +++ b/wizard/deploy.py @@ -78,12 +78,14 @@ def parse_install_lines(show, versions_store, yield_errors = False, user = None) def web(dir, url=None): """ Attempts to determine the URL a directory would be web-accessible at. - If ``url`` is specified, automatically use it. Returns a generator whic + If ``url`` is specified, automatically use it. Returns a generator which produces a list of candidate urls. This function implements a plugin interface named :ref:`wizard.deploy.web`. """ if url: + if isinstance(url, str): + url = urlparse.urlparse(url) yield url return @@ -336,12 +338,17 @@ class Deployment(object): @property def url(self): """The :class:`urlparse.ParseResult` for this deployment.""" - if not self._urlGen: - self._urlGen = web(self.location, self.application.url(self)) + if not self._url: self.nextUrl() return self._url def nextUrl(self): - """""" + """ + Initializes :attr:`url` with a possible URL the web application may + be located at. It may be called again to switch to another possible + URL, usually in the event of a web access failure. + """ + if not self._urlGen: + self._urlGen = web(self.location, self.application.url(self)) try: self._url = self._urlGen.next() # pylint: disable-msg=E1101 return self._url