Hi,

Just tested the branch, I know it's early development, but here's a 
couple of things we could get improved:

1. setup.py: there's no dependency on SQLAlchemy set, so running e.g. 
"test" results in a backtrace, until SQLAlchemy is (easy_)installed.

2. I've got: "ERROR: Testing env.get_known_users" on Windows

Seems due to a  Permission denied: 'c:...trac-tempenv\\db\\trac.db' 
issue. That probably happens because there's a live SQLite connection at 
that time.

3. starting tracd: Could not parse rfc1738 URL from string 
'sqlite:db/trac.db'

Well, we probably want to keep compatibility here with existing [trac] 
db strings. The move to SQLAlchemy should be transparent to the user.

Sorry, no fix for the point 2. The other are quick fixes, worksforme but 
probably need more refinement (the second).

Keep up the good job!

-- Christian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Add dependency on SQLAlchemy.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,8 @@ facilities.
 
     install_requires = [
         'setuptools>=0.6b1',
-        'Genshi>=0.4.1'
+        'Genshi>=0.4.1',
+        'SQLAlchemy>=0.4.1'
     ],
 
     extras_require = {
SQLAlchemy: make_url fails on old-style SQLite connection strings, so we have 
to adapt it beforehand. Also takes care of the Windows specificities (no '/' 
for a root path...)

diff --git a/trac/db/api.py b/trac/db/api.py
--- a/trac/db/api.py
+++ b/trac/db/api.py
@@ -66,12 +66,13 @@ class DatabaseManager(Component):
 
     def __init__(self):
         from sqlalchemy.engine.url import make_url
-        url = make_url(self.connection_uri)
-        if url.drivername == 'sqlite':
-            if url.database != ':memory:' and \
-                   not url.database.startswith('/'):
-                url.database = os.path.join(self.env.path,
-                                            url.database.lstrip('/'))
+        engine, database = self.connection_uri.split(":", 1)
+        if engine == 'sqlite' and database != ':memory:' and \
+                not database.startswith('/'):
+            database = os.path.join(self.env.path, database.lstrip('/'))
+            if os.name == 'nt':
+                database = '///' + database # ///C:\...
+        url = make_url('%s:%s' % (engine, database))
         self._engine = create_engine(url)
         self._url = url
 

Reply via email to