Repository: resync/resync

Issue:
Fix terminology in resync/url_authority.py 
Use "primary" instead of "master"

Comments:

Patch:
diff --git a/resync/url_authority.py b/resync/url_authority.py
index 7697e20..3276b45 100644
--- a/resync/url_authority.py
+++ b/resync/url_authority.py
@@ -14,19 +14,19 @@ class UrlAuthority(object):
     Two modes are supported:
 
     strict=True: requires that a query URL has the same URI
-    scheme (e.g. http) as the master, is on the same server
+    scheme (e.g. http) as the primary, is on the same server
     or one in a sub-domain, and that the path component is
-    at the same level or below the master.
+    at the same level or below the primary.
 
     strict=False (default): requires only that a query URL
-    has the same URI scheme as the master, and is on the same
-    server or one in a sub-domain of the master.
+    has the same URI scheme as the primary, and is on the same
+    server or one in a sub-domain of the primary.
 
     Example use:
 
         from resync.url_authority import UrlAuthority
 
-        auth = UrlAuthority("http://example.org/master")
+        auth = UrlAuthority("http://example.org/primary")
         if (auth.has_authority_over("http://example.com/res1")):
             # will be true
         if (auth.has_authority_over("http://other.com/res1")):
@@ -34,40 +34,40 @@ class UrlAuthority(object):
     """
 
     def __init__(self, url=None, strict=False):
-        """Create object and optionally set master url and/or strict mode."""
+        """Create object and optionally set primary url and/or strict mode."""
         self.url = url
         self.strict = strict
         if (self.url is not None):
-            self.set_master(self.url)
+            self.set_primary(self.url)
         else:
-            self.master_scheme = 'none'
-            self.master_netloc = 'none.none.none'
-            self.master_path = '/not/very/likely'
+            self.primary_scheme = 'none'
+            self.primary_netloc = 'none.none.none'
+            self.primary_path = '/not/very/likely'
 
-    def set_master(self, url):
-        """Set the master url that this object works with."""
+    def set_primary(self, url):
+        """Set the primary url that this object works with."""
         m = urlparse(url)
-        self.master_scheme = m.scheme
-        self.master_netloc = m.netloc
-        self.master_path = os.path.dirname(m.path)
+        self.primary_scheme = m.scheme
+        self.primary_netloc = m.netloc
+        self.primary_path = os.path.dirname(m.path)
 
     def has_authority_over(self, url):
-        """Return True of the current master has authority over url.
+        """Return True of the current primary has authority over url.
 
         In strict mode checks scheme, server and path. Otherwise checks
         just that the server names match or the query url is a
-        sub-domain of the master.
+        sub-domain of the primary.
         """
         s = urlparse(url)
-        if (s.scheme != self.master_scheme):
+        if (s.scheme != self.primary_scheme):
             return(False)
-        if (s.netloc != self.master_netloc):
-            if (not s.netloc.endswith('.' + self.master_netloc)):
+        if (s.netloc != self.primary_netloc):
+            if (not s.netloc.endswith('.' + self.primary_netloc)):
                 return(False)
             # Maybe should allow parallel for 3+ components, eg. a.example.org,
             # b.example.org
         path = os.path.dirname(s.path)
-        if (self.strict and path != self.master_path
-                and not path.startswith(self.master_path)):
+        if (self.strict and path != self.primary_path
+                and not path.startswith(self.primary_path)):
             return(False)
         return(True)


Test patch:
diff --git a/tests/test_url_authority.py b/tests/test_url_authority.py
index 6f5d60f..454a69f 100644
--- a/tests/test_url_authority.py
+++ b/tests/test_url_authority.py
@@ -91,7 +91,7 @@ class TestUrlAuthority(unittest.TestCase):
 
     def test07_no_init_data(self):
         uauth = UrlAuthority()
-        self.assertEqual(uauth.master_scheme, 'none')
+        self.assertEqual(uauth.primary_scheme, 'none')
         self.assertFalse(uauth.has_authority_over(
             'http://a.example.org/sitemap.xml'))
         self.assertFalse(uauth.has_authority_over(