Modify ↓
#13462 closed defect (fixed)
remove static resource import for db backends
Reported by: | Rochi | Owned by: | Russ Tyndall |
---|---|---|---|
Priority: | normal | Component: | TimingAndEstimationPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.2 |
Description
The dbhelper uses static import for db backends. That produces in Trac 1.2.3 an error if not all db backends are installed.
We use mysql, so the postgresql python bindings were not installed.
We fixed it with:
import trac.db.pool import trac.db.sqlite_backend from pkg_resources import DistributionNotFound try: import trac.db.postgres_backend except DistributionNotFound: pass import trac.db.mysql_backend
This workaround needs still some optimization.
Attachments (0)
Change History (6)
comment:1 Changed 6 years ago by
comment:4 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 follow-up: 6 Changed 6 years ago by
Other plugins use this:
dburi = env.config.get('trac', 'database') if dburi.startswith('sqlite:'): pass elif dburi.startswith('postgres:'): pass elif dburi.startswith('mysql:'): pass
For example https://trac-hacks.org/browser/tracmigrateplugin/0.12/tracmigrate/admin.py
comment:6 Changed 6 years ago by
Replying to anonymous:
Other plugins use this:
dburi = env.config.get('trac', 'database') if dburi.startswith('sqlite:'): pass elif dburi.startswith('postgres:'): pass elif dburi.startswith('mysql:'): passFor example https://trac-hacks.org/browser/tracmigrateplugin/0.12/tracmigrate/admin.py
I think this is a good approach, but the env is actual not available.
@Russ Thx for the very fast fix.
Note: See
TracTickets for help on using
tickets.
Howdy, I will look into this. I think I am mostly doing this to enable different syntax for specific databases, so I might be able to be more forgiving.