Commits

Sebastian Wiesner  committed b4dfa58

It's an URL, not an URI

  • Participants
  • Parent commits 4210e74

Comments (0)

Files changed (5)

File issuetracker/doc/index.rst

       :event:`issuetracker-resolve-issue`, set this attribute to the
       ``issue_id`` that was given as argument.
 
-   .. attribute:: uri
+   .. attribute:: url
 
-      An URI providing information about this issue.
+      An URL providing information about this issue.
 
-      This URI is used as hyperlink target in the generated documentation.
+      This URL is used as hyperlink target in the generated documentation.
       Thus it should point to a webpage or something similar that provides
       human-readable information about an issue.
 

File issuetracker/sphinxcontrib/issuetracker.py

 from sphinx.util.console import bold
 
 
-Issue = namedtuple('Issue', 'id title uri closed')
+Issue = namedtuple('Issue', 'id title url closed')
 
 _TrackerConfig = namedtuple('_TrackerConfig', 'project url')
 
 def lookup_github_issue(app, tracker_config, issue_id):
     check_project_with_username(tracker_config)
 
-    url = GITHUB_API_URL.format(tracker_config, issue_id)
-    issue = fetch_issue(app, url, output_format='json')
+    issue = fetch_issue(app, GITHUB_API_URL.format(tracker_config, issue_id),
+                        output_format='json')
     if issue:
         closed = issue['state'] == 'closed'
         return Issue(id=issue_id, title=issue['title'], closed=closed,
-                     uri=issue['html_url'])
+                     url=issue['html_url'])
 
 
 BITBUCKET_URL = 'https://bitbucket.org/{0.project}/issue/{1}/'
 def lookup_bitbucket_issue(app, tracker_config, issue_id):
     check_project_with_username(tracker_config)
 
-    url = BITBUCKET_API_URL.format(tracker_config, issue_id)
-    issue = fetch_issue(app, url, output_format='json')
+    issue = fetch_issue(app, BITBUCKET_API_URL.format(tracker_config, issue_id),
+                        output_format='json')
     if issue:
         closed = issue['status'] not in ('new', 'open')
-        uri=BITBUCKET_URL.format(tracker_config, issue_id)
-        return Issue(id=issue_id, title=issue['title'], closed=closed, uri=uri)
+        url = BITBUCKET_URL.format(tracker_config, issue_id)
+        return Issue(id=issue_id, title=issue['title'], closed=closed, url=url)
 
 
 DEBIAN_URL = 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug={0}'
         return None
 
     return Issue(id=issue_id, title=bug.subject, closed=bug.done,
-                 uri=DEBIAN_URL.format(issue_id))
+                 url=DEBIAN_URL.format(issue_id))
 
 
 LAUNCHPAD_URL = 'https://bugs.launchpad.net/bugs/{0}'
         return None
 
     return Issue(id=issue_id, title=task.title, closed=bool(task.date_closed),
-                 uri=LAUNCHPAD_URL.format(issue_id))
+                 url=LAUNCHPAD_URL.format(issue_id))
 
 
 GOOGLE_CODE_URL = 'http://code.google.com/p/{0.project}/issues/detail?id={1}'
                        '{0.project}/issues/full/{1}')
 
 def lookup_google_code_issue(app, tracker_config, issue_id):
-    url = GOOGLE_CODE_API_URL.format(tracker_config, issue_id)
-    issue = fetch_issue(app, url, output_format='xml')
+    issue = fetch_issue(app, GOOGLE_CODE_API_URL.format(
+        tracker_config, issue_id), output_format='xml')
     if issue:
         ISSUE_NS = '{http://schemas.google.com/projecthosting/issues/2009}'
         ATOM_NS = '{http://www.w3.org/2005/Atom}'
         title = title_node.text if title_node is not None else None
         closed = state is not None and state.text == 'closed'
         return Issue(id=issue_id, title=title, closed=closed,
-                     uri=GOOGLE_CODE_URL.format(tracker_config, issue_id))
+                     url=GOOGLE_CODE_URL.format(tracker_config, issue_id))
 
 
 JIRA_API_URL = ('{0.url}/si/jira.issueviews:issue-xml/{1}/{1}.xml?'
         if project != tracker_config.project:
             return None
 
-        uri = issue.find('*/item/link').text
+        url = issue.find('*/item/link').text
         state = issue.find('*/item/resolution').text
         # summary contains the title without the issue id
         title = issue.find('*/item/summary').text
         closed = state.lower() != 'unresolved'
-        return Issue(id=issue_id, title=title, closed=closed, uri=uri)
+        return Issue(id=issue_id, title=title, closed=closed, url=url)
 
 
 BUILTIN_ISSUE_TRACKERS = {
     Return a :class:`docutils.nodes.reference` for the issue.
     """
     reference = nodes.reference()
-    reference['refuri'] = issue.uri
+    reference['refuri'] = issue.url
     if issue.closed:
         reference['classes'].append('issue-closed')
     reference['classes'].append('reference-issue')

File issuetracker/tests/conftest.py

     __tracebackhide__ = True
     reference = doctree.find('reference')
     assert len(reference) == 1
-    assert reference.attr.refuri == issue.uri
+    assert reference.attr.refuri == issue.url
     classes = reference.attr.classes.split(' ')
     is_closed = 'issue-closed' in classes
     assert 'reference-issue' in classes

File issuetracker/tests/test_builtin_resolvers.py

 
     SPHINX_URL = 'https://bitbucket.org/birkenfeld/sphinx/issue/{0}/'
     issues = {
-        'resolved': Issue(id='478', closed=True, uri=SPHINX_URL.format('478'),
+        'resolved': Issue(id='478', closed=True, url=SPHINX_URL.format('478'),
                            title='Adapt py:decorator from Python docs'),
-        'invalid': Issue(id='327', closed=True, uri=SPHINX_URL.format('327'),
+        'invalid': Issue(id='327', closed=True, url=SPHINX_URL.format('327'),
                          title='Spaces at the end of console messages'),
-        'duplicate': Issue(id='733', closed=True, uri=SPHINX_URL.format('733'),
+        'duplicate': Issue(id='733', closed=True, url=SPHINX_URL.format('733'),
                            title='byte/str conversion fails on Python 3.2'),
         'no project': '10',
         'no issue': '10000'
 
     issues = {
         'closed': Issue(id='2', title=u'python 3 support', closed=True,
-                        uri='https://github.com/lunaryorn/pyudev/issues/2'),
+                        url='https://github.com/lunaryorn/pyudev/issues/2'),
         'no project': '10',
         'no issue': '1000',
     }
 
     PYTOX_URL = 'http://code.google.com/p/pytox/issues/detail?id={0}'
     issues = {
-        'fixed': Issue(id='2', closed=True, uri=PYTOX_URL.format('2'),
+        'fixed': Issue(id='2', closed=True, url=PYTOX_URL.format('2'),
                        title='Hudson exists with SUCCESS status even if tox '
                        'failed with ERROR'),
         'invalid': Issue(id='5', title='0.7: "error: File exists"',
-                         closed=True, uri=PYTOX_URL.format('5')),
+                         closed=True, url=PYTOX_URL.format('5')),
         'wontfix': Issue(id='6', title='Copy modules from site packages',
-                         closed=True, uri=PYTOX_URL.format('6')),
+                         closed=True, url=PYTOX_URL.format('6')),
         'no issue': '1000',
         'no project': '1',
     }
     DEBIAN_URL = 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug={0}'
     issues = {
         'fixed': Issue(id='584227', title='ldb-tools: missing ldb(7) manpage',
-                       closed=True, uri=DEBIAN_URL.format('584227')),
+                       closed=True, url=DEBIAN_URL.format('584227')),
         'no project': '1',
     }
 
     issues = {
         'closed': Issue('647789', title='tries to install file(s) outside of '
                         './configure\'s --prefix', closed=True,
-                        uri='https://bugs.launchpad.net/bugs/647789')
+                        url='https://bugs.launchpad.net/bugs/647789')
     }
 
 
     issues = {
         'resolved': Issue('SHERPA-15', closed=True, title='Breadcrumbs and '
                           'page title missing from admin screens',
-                          uri='https://studio.atlassian.com/browse/SHERPA-15'),
+                          url='https://studio.atlassian.com/browse/SHERPA-15'),
         'open': Issue('PYO-84', closed=False,
                       title='Implement LLSD login in pyogp',
-                      uri='https://jira.secondlife.com/browse/PYO-84'),
+                      url='https://jira.secondlife.com/browse/PYO-84'),
     }
 
     tracker_config = {

File issuetracker/tests/test_references.py

         'An issue id in normal text #10 should be transformed'
 
 
-@pytest.mark.issue(id='10', title='Spam', uri='spam', closed=False)
+@pytest.mark.issue(id='10', title='Spam', url='spam', closed=False)
 def test_open_issue(build_app, doctree, issue):
     assert build_app.env.issuetracker_cache == {'10': issue}
     reference = pytest.assert_issue_reference(doctree, issue)
         'An issue id in normal text #10 should be transformed'
 
 
-@pytest.mark.issue(id='10', title='Eggs', uri='eggs', closed=True)
+@pytest.mark.issue(id='10', title='Eggs', url='eggs', closed=True)
 def test_closed_issue(build_app, doctree, issue):
     assert build_app.env.issuetracker_cache == {'10': issue}
     reference = pytest.assert_issue_reference(doctree, issue)
 
 
 @pytest.mark.confoverrides(issuetracker_expandtitle=True)
-@pytest.mark.issue(id='10', title='Eggs', uri='eggs', closed=True)
+@pytest.mark.issue(id='10', title='Eggs', url='eggs', closed=True)
 def test_closed_issue_with_title(build_app, doctree, issue):
     assert build_app.env.issuetracker_cache == {'10': issue}
     reference = pytest.assert_issue_reference(doctree, issue, title=True)