Opened 16 years ago
Closed 16 years ago
#3830 closed defect (fixed)
trac-admin initenv with --inherit option fails
Reported by: | JaeWook Choi | Owned by: | Vladislav Naumov |
---|---|---|---|
Priority: | normal | Component: | TracUnreadPlugin |
Severity: | major | Keywords: | |
Cc: | JaeWook Choi | Trac Release: | 0.11 |
Description
If TracUnreadPlugin is activated when trac environment is initialized using '--inherit' option, trac enviroment will be failed with following error message.
Creating and Initializing Project Done Initenv for 'd:\pubs\trac\site\test2' failed. Failed to create environment. 'TracUnreadSetupParticipant' object has no attribute 'environment_needs_upgarde' Traceback (most recent call last): File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\admin\console.p y", line 568, in do_initenv options=options) File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\env.py", line 1 94, in __init__ setup_participant.environment_created() File "build\bdist.win32\egg\trac_unread\env_setup.py", line 39, in environment _created if self.environment_needs_upgarde(db): AttributeError: 'TracUnreadSetupParticipant' object has no attribute 'environmen t_needs_upgarde'
I changed 'env_setup.py' as shown below, and it seems to work fine now.
Index: 0.11/trac_unread/env_setup.py =================================================================== --- 0.11/trac_unread/env_setup.py (revision 4358) +++ 0.11/trac_unread/env_setup.py (working copy) @@ -35,8 +35,9 @@ def environment_created(self): """Called when a new Trac environment is created.""" - if self.environment_needs_upgrade(None): - self.upgrade_environment(None) + db = self.env.get_db_cnx() + if self.environment_needs_upgrade(db): + self.upgrade_environment(db) def environment_needs_upgrade(self, db): """Called when Trac checks whether the environment needs to be upgraded.
Attachments (1)
Change History (4)
Changed 16 years ago by
Attachment: | environment_created.diff added |
---|
comment:1 Changed 16 years ago by
Status: | new → assigned |
---|
comment:2 Changed 16 years ago by
Hello vnaum
I don't know how I got that backtrace posted above and just realized that it was different from what I remebered. The below is full command and backtrace again.
D:\pubs>trac-admin d:\pubs\trac\site\test_unread initenv --inherit=d:\pubs\trac\ share\conf\trac-unread.ini Creating a new Trac environment at d:\pubs\trac\site\test_unread Trac will first ask a few questions about your environment in order to initialize and prepare the project database. Please enter the name of your project. This name will be used in page titles and descriptions. Project Name [My Project]> TracUnreadPlugin Test Please specify the connection string for the database to use. By default, a local SQLite database is created in the environment directory. It is also possible to use an already existing PostgreSQL database (check the Trac documentation for the exact connection string syntax). Database connection string [sqlite:db/trac.db]> Please specify the type of version control system, By default, it will be svn. If you don't want to use Trac with version control integration, choose the default here and don't specify a repository directory. in the next question. Repository type [svn]> Please specify the absolute path to the version control repository, or leave it blank to use Trac without a repository. You can also set the repository location later. Path to repository [/path/to/repos]> Creating and Initializing Project Done TracUnread needs an upgrade Upgrading Database Initenv for 'd:\pubs\trac\site\test_unread' failed. Failed to create environment. 'NoneType' object has no attribute 'cursor' Traceback (most recent call last): File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\admin\console.p y", line 568, in do_initenv options=options) File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\env.py", line 1 94, in __init__ setup_participant.environment_created() File "build\bdist.win32\egg\trac_unread\env_setup.py", line 39, in environment _created self.upgrade_environment(None) File "build\bdist.win32\egg\trac_unread\env_setup.py", line 55, in upgrade_env ironment cur = db.cursor() AttributeError: 'NoneType' object has no attribute 'cursor' D:\pubs>
System Information
- Trac: 0.11.1
- Python: 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
- setuptools: 0.6c8
- SQLite: 3.3.4
- pysqlite: 2.3.2
- Genshi: 0.5.1
- mod_python: 3.3.1
- Pygments: 0.10
- Subversion: 1.5.1 (r32289)
- jQuery: 1.2.6
Backtrace shows trac_unread\env_setup.py, line 39 as
if self.environment_needs_upgarde(db):
Looks like you patch with a typo in it. My code in SVN does not have this string at all.
Can you show command you're running and relevant backtrace, please?
The above line in the patch is provided as a replacement of if self.environment_needs_upgarde(None): at line 38 in the original code.
comment:3 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks for the info and patch!
I finally could repeat the bug, and your patch applied as revision 4362.
Could not repeat this bug.
This is what I tried (with trac 0.11 and trac 0.11.1):
Can you show exact command you were running?
Also, your backtrace does not seem to be relevant to the patch code you provided: 'TracUnreadSetupParticipant' object has an attribute 'environment_needs_upgrade', not 'environment_needs_upgarde'.
Backtrace shows
trac_unread\env_setup.py, line 39
asLooks like you patch with a typo in it. My code in SVN does not have this string at all.
Can you show command you're running and relevant backtrace, please?