Commits

Alessio Caiazza committed 0a3162f Merge

flow: Merged <feature> 'multiple_repos' to <develop> ('develop').

Comments (0)

Files changed (1)

hgredmine/hgweb.py

         Find repos from Redmine database.
         """
         dbcur = db.cursor()
-        dbcur.execute('SELECT projects.identifier, repositories.url, repositories.is_default ' +
-                            'FROM projects, repositories '
-                            'WHERE repositories.type=\'Repository::Mercurial\' ' +
-                            'AND projects.id = repositories.project_id '
-                       )
+        dbcur.execute(
+            'SELECT projects.identifier, repositories.url, repositories.is_default, repositories.identifier ' +
+            'FROM projects, repositories '
+            'WHERE repositories.type=\'Repository::Mercurial\' ' +
+            'AND projects.id = repositories.project_id '
+            )
         
         repos = {}
         row = dbcur.fetchone()
         
         while row:
-            if _sanitize_db_boolean(row[2]):
-                project_id = _sanitize_db_string(row[0])
-                repo_url = _sanitize_db_string(row[1])
-                repos[project_id] = repo_url
+            project_id = _sanitize_db_string(row[0])
+            repo_url = _sanitize_db_string(row[1])
+            if not _sanitize_db_boolean(row[2]):
+                project_id += ("::"+_sanitize_db_string(row[3]))
+            repos[project_id] = repo_url
             row = dbcur.fetchone()
             
         self.repos = repos.items()
         
     def _setup_repo(self, db, repo, project_id):
         dbcur = db.cursor()
+        real_project_id = project_id.split('::')[0]
         dbcur.execute('SELECT projects.name, projects.description FROM projects '
                             'WHERE projects.identifier=%s' % (self.placeholder,),
-                      (project_id, )
+                      (real_project_id, )
                      )
         
         row = dbcur.fetchone()