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
@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