Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use 0.12-style database accessor methods instead of the context manag…

…ers introduced in 0.13/dev
  • Loading branch information...
commit fa4304ba588cd6bec08e2e68f242259bd742222e 1 parent d744391
ejucovy ejucovy authored
Showing with 10 additions and 9 deletions.
  1. +10 −9 multireposearch/sqlindexer.py
19 multireposearch/sqlindexer.py
View
@@ -16,10 +16,9 @@ class SqlIndexer(Component):
## internal methods
def _last_known_rev(self, reponame):
- with self.env.db_query as db:
- indexed_rev = get_scalar(self.env,
- "SELECT version FROM repository_version WHERE repo=%s",
- 0, reponame)
+ indexed_rev = get_scalar(self.env,
+ "SELECT version FROM repository_version WHERE repo=%s",
+ 0, reponame)
return indexed_rev
def _walk_repo(self, repo, path):
@@ -51,7 +50,9 @@ def reindex_repository(self, reponame, verbose=False):
if verbose: print "Repo %s DOES need reindexing" % reponame
mimeview = Mimeview(self.env)
- with self.env.db_transaction as db:
+
+ @self.env.with_transaction()
+ def do_reindex(db):
cursor = db.cursor()
for node in self._walk_repo(repo, "/"):
@@ -80,10 +81,10 @@ def reindex_repository(self, reponame, verbose=False):
def find_words(self, query):
- with self.env.db_query as db:
- sql, args = search_to_sql(db, ['contents'], query)
- for id, filename, repo in db(self.query % sql, args):
- yield filename, repo
+ db = self.env.get_read_db()
+ sql, args = search_to_sql(db, ['contents'], query)
+ for id, filename, repo in db(self.query % sql, args):
+ yield filename, repo
### methods for IEnvironmentSetupParticipant
Please sign in to comment.
Something went wrong with that request. Please try again.