Modify ↓
      
Opened 16 months ago
#13768 new defect
Default wiki pages imported even if initenv --no-default-data
| Reported by: | Jun Omae | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | next-stable-1.6.x | 
| Component: | wiki system | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
I tried initenv --no-default-data to want to fill only system table, but default wiki pages imported unexpectedly.
$ ~/venv/trac/1.6/bin/trac-admin /tmp/tracenv-no-default initenv --no-default-data project-name sqlite:db/trac.db Creating a new Trac environment at /tmp/tracenv-no-default Project environment for 'project-name' created. You may configure the environment by editing the file: /tmp/tracenv-no-default/conf/trac.ini You can run the Trac standalone web server `tracd` and point your browser to http://localhost:8000/tracenv-no-default. tracd --port 8000 /tmp/tracenv-no-default Navigate to "Help/Guide" to browse the documentation for Trac, including information on further setup (such as deploying Trac to a real web server). The latest documentation can also be found on the project website: https://trac.edgewall.org/ $ sqlite3 /tmp/tracenv-no-default/db/trac.db SQLite version 3.31.1 2020-01-27 19:55:54 Enter ".help" for usage hints. sqlite> select * from system; initial_database_version|45 database_version|45 sqlite> select count(*) from enum; 0 sqlite> select count(*) from wiki; 60
This behavior leads invoking wiki_page_added listener before creating backlink table which provided by th:TracBackLinkPlugin and an exception raises in the listener.
$ python3 -m venv /dev/shm/trac16
$ /dev/shm/trac16/bin/pip install -q Trac
$ /dev/shm/trac16/bin/pip install -q svn+https://trac-hacks.org/svn/tracbacklinkplugin/1.0
$ cat >/dev/shm/inherit.ini
[components]
tracbacklink.* = enabled
$ /dev/shm/trac16/bin/trac-admin /dev/shm/tracenv-no-default-data initenv --inherit=/dev/shm/inherit.ini --no-default-data project-name sqlite:db/trac.db
Creating a new Trac environment at /dev/shm/tracenv-no-default-data
Project environment for 'project-name' created.
You may configure the environment by editing the file:
  /dev/shm/tracenv-no-default-data/conf/trac.ini
You can run the Trac standalone web server `tracd` and point
your browser to http://localhost:8000/tracenv-no-default-data.
  tracd --port 8000 /dev/shm/tracenv-no-default-data
Navigate to "Help/Guide" to browse the documentation for Trac,
including information on further setup (such as deploying Trac
to a real web server).
The latest documentation can also be found on the project
website:
  https://trac.edgewall.org/
$ head -25 /dev/shm/tracenv-no-default-data/log/trac.log
2024-07-19 11:24:51,933 Trac[env] INFO: -------------------------------- environment startup [Trac 1.6] --------------------------------
2024-07-19 11:24:52,106 Trac[env] INFO: Wrote sample configuration file with the new settings and their default values: /dev/shm/tracenv-no-default-data/conf/trac.ini.sample
2024-07-19 11:24:52,116 Trac[admin] INFO: Installing default wiki pages
2024-07-19 11:24:52,116 Trac[env] WARNING: [trac] base_url option not set in configuration, generated links may be incorrect
2024-07-19 11:24:52,134 Trac[api] WARNING: Exception caught while "wiki_page_added"
Traceback (most recent call last):
  File "/dev/shm/trac16/lib/python3.10/site-packages/tracbacklink/api.py", line 291, in _invoke
    return f(*args, **kwargs)
  File "/dev/shm/trac16/lib/python3.10/site-packages/tracbacklink/api.py", line 311, in _wiki_added
    self._resource_added(self.gather_links_from_wiki(page))
  File "/dev/shm/trac16/lib/python3.10/site-packages/tracbacklink/api.py", line 396, in _resource_added
    db.executemany("""\
  File "/dev/shm/trac16/lib/python3.10/site-packages/trac/db/util.py", line 146, in executemany
    cursor.executemany(query, params)
  File "/dev/shm/trac16/lib/python3.10/site-packages/trac/db/util.py", line 93, in executemany
    return self.cursor.executemany(sql_escape_percent(sql), args)
  File "/dev/shm/trac16/lib/python3.10/site-packages/trac/db/sqlite_backend.py", line 71, in executemany
    return self._rollback_on_error(sqlite.Cursor.executemany, sql,
  File "/dev/shm/trac16/lib/python3.10/site-packages/trac/db/sqlite_backend.py", line 56, in _rollback_on_error
    return function(self, *args, **kwargs)
sqlite3.OperationalError: no such table: backlink
2024-07-19 11:24:52,134 Trac[admin] INFO: CamelCase imported from /dev/shm/trac16/lib/python3.10/site-packages/trac/wiki/default-pages/CamelCase
2024-07-19 11:24:52,138 Trac[api] WARNING: Exception caught while "wiki_page_added"
Traceback (most recent call last):
  File "/dev/shm/trac16/lib/python3.10/site-packages/tracbacklink/api.py", line 291, in _invoke
      Attachments (0)
  Note:
 See   TracTickets
 for help on using tickets.
    

