Merge branch 'drop-lighthouse' into maint_2_5

This commit is contained in:
Daniele Varrazzo 2014-08-28 17:08:17 +01:00
commit 11c9fcb9d4
3 changed files with 41 additions and 19 deletions

4
NEWS
View File

@ -123,7 +123,7 @@ What's new in psycopg 2.4.6
- 'register_hstore()', 'register_composite()', 'tpc_recover()' work with
RealDictConnection and Cursor (:ticket:`#114`).
- Fixed broken pool for Zope and connections re-init across ZSQL methods
in the same request (tickets #123, #125, #142).
in the same request (:tickets:`#123, #125, #142`).
- connect() raises an exception instead of swallowing keyword arguments
when a connection string is specified as well (:ticket:`#131`).
- Discard any result produced by 'executemany()' (:ticket:`#133`).
@ -145,7 +145,7 @@ What's new in psycopg 2.4.5
- Error and its subclasses are picklable, useful for multiprocessing
interaction (:ticket:`#90`).
- Better efficiency and formatting of timezone offset objects thanks
to Menno Smits (tickets #94, #95).
to Menno Smits (:tickets:`#94, #95`).
- Fixed 'rownumber' during iteration on cursor subclasses.
Regression introduced in 2.4.4 (:ticket:`#100`).
- Added support for 'inet' arrays.

View File

@ -68,7 +68,9 @@ intersphinx_mapping = {
}
# Pattern to generate links to the bug tracker
ticket_url = 'http://psycopg.lighthouseapp.com/projects/62710/tickets/%s'
ticket_url = 'https://github.com/psycopg/psycopg2/issues/%s'
ticket_remap_until = 25
ticket_remap_offset = 235
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -3,37 +3,57 @@
ticket role
~~~~~~~~~~~
An interpreted text role to link docs to lighthouse issues.
An interpreted text role to link docs to tickets issues.
:copyright: Copyright 2013 by Daniele Varrazzo.
"""
import re
from docutils import nodes, utils
from docutils.parsers.rst import roles
def ticket_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
try:
num = int(text.replace('#', ''))
except ValueError:
msg = inliner.reporter.error(
"ticket number must be... a number, got '%s'" % text)
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
url_pattern = inliner.document.settings.env.app.config.ticket_url
if url_pattern is None:
cfg = inliner.document.settings.env.app.config
if cfg.ticket_url is None:
msg = inliner.reporter.warning(
"ticket not configured: please configure ticket_url in conf.py")
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
url = url_pattern % num
roles.set_classes(options)
node = nodes.reference(rawtext, 'ticket ' + utils.unescape(text),
refuri=url, **options)
return [node], []
rv = [nodes.Text(name + ' ')]
tokens = re.findall(r'(#?\d+)|([^\d#]+)', text)
for ticket, noise in tokens:
if ticket:
num = int(ticket.replace('#', ''))
# Push numbers of the oldel tickets ahead.
# We moved the tickets from a different tracker to GitHub and the
# latter already had a few ticket numbers taken (as merge
# requests).
remap_until = cfg.ticket_remap_until
remap_offset = cfg.ticket_remap_offset
if remap_until and remap_offset:
if num <= remap_until:
num += remap_offset
url = cfg.ticket_url % num
roles.set_classes(options)
node = nodes.reference(ticket, utils.unescape(ticket),
refuri=url, **options)
rv.append(node)
else:
assert noise
rv.append(nodes.Text(noise))
return rv, []
def setup(app):
app.add_config_value('ticket_url', None, 'env')
app.add_config_value('ticket_remap_until', None, 'env')
app.add_config_value('ticket_remap_offset', None, 'env')
app.add_role('ticket', ticket_role)
app.add_role('tickets', ticket_role)