Edgewall Software

Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#11894 closed defect (fixed)

_parse_db_str should not be a protected member of module

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.3
Component: database backend Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Renamed _parse_db_str in the trac.db.api module to parse_connection_uri. The latter is aliased to the former for backwards compatibility.

Internal Changes:


_parse_db_str in trac.db.api is used throughout Trac. We should rename the function to parse_db_str, aliasing it to _parse_db_str for backward compatibility.

$ grep -R "import.*_parse_db_str" --exclude-dir=.svn --exclude-dir=htmlcov
trac/db/tests/api.py:from trac.db.api import DatabaseManager, _parse_db_str, get_column_names, \
trac/db/postgres_backend.py:from trac.db.api import ConnectionBase, IDatabaseConnector, _parse_db_str
trac/test.py:from trac.db.api import DatabaseManager, _parse_db_str

Attachments (0)

Change History (6)

comment:1 by Ryan J Ollos, 8 years ago

Status: newassigned

Proposed changes in log:rjollos.git:t11894.

comment:2 by Jun Omae, 8 years ago

Fine by me. The method is used by few plugins.

$ git grep -w _parse_db_str | sed -e 's#/.*$##' | sort | uniq -c
     12 tracfrenchtranslation
      2 tracmigrateplugin
     12 traditionalchinesetranslation
     62 zoomquiettranslation

comment:3 by Peter Suter, 8 years ago

Looks good.

Would parse_db_connection_string be too long? I think connection string is less ambiguous.

The description could maybe mention the [trac] database TracIni option.

in reply to:  3 comment:4 by Ryan J Ollos, 8 years ago

Replying to psuter:

Would parse_db_connection_string be too long? I think connection string is less ambiguous.

A more descriptive name sounds good. To shorten it we could use cnx rather than connection, but I think parse_db_connection_string is good.

comment:5 by Ryan J Ollos, 8 years ago

parse_connection_uri (or parse_db_connection_uri) would be a bit shorter as well.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:6 by Ryan J Ollos, 8 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [13583].

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.