]> scripts.mit.edu Git - wizard.git/commitdiff
Properly parse string URLs, and document nextUrl().
authorEdward Z. Yang <ezyang@mit.edu>
Tue, 6 Jul 2010 05:01:49 +0000 (01:01 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Tue, 6 Jul 2010 05:01:49 +0000 (01:01 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/deploy.py

index 27a1bb30bbb6d8b4d0712666f725bb1819f1f490..d559c79afcb28a8840d7747ce2d430cc96344c06 100644 (file)
@@ -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