Commits

Adam Gomaa committed 1dc4438

fix adding the first repo.

Comments (0)

Files changed (1)

trac/versioncontrol/api.py

         for doc in self.env.db.repository.find({"name": "name", "value": reponame}):
             return doc['id']
         cur_max = self.env.db.repository.find().sort([("id", -1)]).limit(1)
-        if cur_max is None:
+        try:
+            new_id = cur_max.next() + 1
+        except StopIteration:
             new_id = 1
-        else:
-            new_id = cur_max['id'] + 1
         self.env.db.repository.insert({
                 "id": new_id, "name": "name", "value": reponame})
         return self.get_repository_id(reponame)