Merge lp:~tristan-rivoallan/trac-errorcollectionplugin/devel into lp:trac-errorcollectionplugin

Proposed by Tristan Rivoallan
Status: Merged
Approved by: Tristan Rivoallan
Approved revision: 3
Merge reported by: Tristan Rivoallan
Merged at revision: not available
Proposed branch: lp:~tristan-rivoallan/trac-errorcollectionplugin/devel
Merge into: lp:trac-errorcollectionplugin
Diff against target: 36 lines (+6/-3)
1 file modified
errorcollectionplugin/db.py (+6/-3)
To merge this branch: bzr merge lp:~tristan-rivoallan/trac-errorcollectionplugin/devel
Reviewer Review Type Date Requested Status
Tristan Rivoallan Approve
Review via email: mp+21062@code.launchpad.net

Commit message

Enhanced documentation in db.py

To post a comment you must log in.
Revision history for this message
Tristan Rivoallan (tristan-rivoallan) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'errorcollectionplugin/db.py'
2--- errorcollectionplugin/db.py 2010-03-10 14:25:29 +0000
3+++ errorcollectionplugin/db.py 2010-03-10 16:21:19 +0000
4@@ -30,19 +30,21 @@
5 # Create tables
6
7 def to_sql(env, table):
8+ """Converts a trac.db.schema specification to SQL compatible with database manager driver"""
9 from trac.db.api import DatabaseManager
10 dataManager = env.components[DatabaseManager]
11 dc = dataManager._get_connector()[0]
12 return dc.to_sql(table)
13
14 def create_tables(env, db):
15+ """Creates schema in database"""
16 cursor = db.cursor()
17 for table in schema:
18 for stmt in to_sql(env, table):
19 cursor.execute(stmt)
20- #As execute expect a sequence or a tuple
21- #http://docs.python.org/library/sqlite3.html
22- #http://stackoverflow.com/questions/228912/sqlite-parameter-substitution-problem
23+ # As execute expect a sequence or a tuple
24+ # http://docs.python.org/library/sqlite3.html
25+ # http://stackoverflow.com/questions/228912/sqlite-parameter-substitution-problem
26 cursor.execute("INSERT into system values ('errorcollection_version', %s)", (str(db_version),));
27
28 # Upgrades
29@@ -74,6 +76,7 @@
30 (str(db_version),))
31
32 def _get_version(self, db):
33+ """Returns currently installed database schema version"""
34 cursor = db.cursor()
35 try:
36 sql = "SELECT value FROM system WHERE name='errorcollection_version'"

Subscribers

People subscribed via source and target branches

to all changes: