#19083 closed Bug (invalid)
postgresql_psycopg2 backend - rename get_version to get_pg_version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
the problem is with this function:
https://github.com/django/django/blob/master/django/db/backends/postgresql_psycopg2/version.py#L24
get_version function normally is expected to just return module version without asking for params.
tools like raven that on crashes are reporting module versions fail in the case of this module (bug filed https://github.com/getsentry/raven-python/issues/143) because the get_version here does something else and expects a connection
renaming the function to something like get_postgres_version solves the issue
Change History (3)
comment:1 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
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
a sample search:
http://code.ohloh.net/search?s=%22get_version%22&browser=Default&pp=0&fl=Python&fd=mdef&mp=1&ml=0&me=1&md=1&ff=1&filterChecked=true
Shows that there are quite a few cases where the version is missing and much less often function by name get_version is expecting any vars.
Filing a bug against all these cases so that raven could rely only on version 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.
comment:3 by , 12 years ago
the underlined "version" in the comment above were meant to be ___version___
of course
Expected by whom? The most popular convention I've seen is using
__version__
(which is what PEP 396 will also define).