Django: Ticket #19083: postgresql_psycopg2 backend - rename get_version to get_pg_versionhttps://code.djangoproject.com/ticket/19083
<p>
the problem is with this function:
<a class="ext-link" href="https://github.com/django/django/blob/master/django/db/backends/postgresql_psycopg2/version.py#L24"><span class="icon">​</span>https://github.com/django/django/blob/master/django/db/backends/postgresql_psycopg2/version.py#L24</a>
</p>
<p>
get_version function normally is expected to just return module version without asking for params.
</p>
<p>
tools like raven that on crashes are reporting module versions fail in the case of this module (bug filed <a class="ext-link" href="https://github.com/getsentry/raven-python/issues/143"><span class="icon">​</span>https://github.com/getsentry/raven-python/issues/143</a>) because the get_version here does something else and expects a connection
</p>
<p>
renaming the function to something like get_postgres_version solves the issue
</p>
en-usDjangohttps://www.djangoproject.com/s/img/site/hdr_logo.gifhttps://code.djangoproject.com/ticket/19083
Trac 1.0.7lrekuckiFri, 26 Oct 2012 19:18:38 GMTstatus changed; needs_docs, resolution, needs_tests, needs_better_patch sethttps://code.djangoproject.com/ticket/19083#comment:1
https://code.djangoproject.com/ticket/19083#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>needs_docs</strong>
unset
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
<li><strong>needs_tests</strong>
unset
</li>
<li><strong>needs_better_patch</strong>
unset
</li>
</ul>
<blockquote class="citation">
<p>
get_version function normally is expected to just return module version without asking for params.
</p>
</blockquote>
<p>
Expected by whom? The most popular convention I've seen is using <tt>__version__</tt> (which is what PEP 396 will also define).
</p>
Tickettoms.baugis@…Sun, 04 Nov 2012 10:39:54 GMThttps://code.djangoproject.com/ticket/19083#comment:2
https://code.djangoproject.com/ticket/19083#comment:2
<p>
raven is the backend for sentry that makes it possible to follow traces in production in an easy manner. one thing that is does is trying to pull out versions from all the modules
</p>
<p>
a sample search:
<a class="ext-link" href="http://code.ohloh.net/search?s=%22get_version%22&amp;browser=Default&amp;pp=0&amp;fl=Python&amp;fd=mdef&amp;mp=1&amp;ml=0&amp;me=1&amp;md=1&amp;ff=1&amp;filterChecked=true"><span class="icon">​</span>http://code.ohloh.net/search?s=%22get_version%22&amp;browser=Default&amp;pp=0&amp;fl=Python&amp;fd=mdef&amp;mp=1&amp;ml=0&amp;me=1&amp;md=1&amp;ff=1&amp;filterChecked=true</a>
</p>
<p>
Shows that there are quite a few cases where the <span class="underline">version</span> is missing and much less often function by name get_version is expecting any vars.
</p>
<p>
Filing a bug against all these cases so that raven could rely only on <span class="underline">version</span> is unfeasible, but changing the function name in django posgtres backend to get_db_version would be trivial and also an arguably better function name.
</p>
Tickettoms.baugis@…Sun, 04 Nov 2012 10:42:03 GMThttps://code.djangoproject.com/ticket/19083#comment:3
https://code.djangoproject.com/ticket/19083#comment:3
<p>
the underlined "version" in the comment above were meant to be <tt>___version___</tt> of course
</p>
Ticket