From e79f6567efae1b7051302103456a5401800cecde Mon Sep 17 00:00:00 2001 From: Metin Akdere Date: Fri, 11 Nov 2011 13:42:14 +0000 Subject: [PATCH] repodb: Handle get_repo_doc and get_repo_url functions properly When trying to retrieve the document or URL of a repo that does not exist, raise appropriate exceptions. BUG:FIXED:18681 --- pisi/db/repodb.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pisi/db/repodb.py b/pisi/db/repodb.py index db061db3..bba631c8 100644 --- a/pisi/db/repodb.py +++ b/pisi/db/repodb.py @@ -151,6 +151,9 @@ class RepoDB(lazydb.LazyDB): return url in self.list_repo_urls(only_active) def get_repo_doc(self, repo_name): + if not self.has_repo(repo_name): + raise RepoError(_("Repository %s does not exist.") % repo) + repo = self.get_repo(repo_name) index_path = repo.indexuri.get_uri() @@ -178,6 +181,9 @@ class RepoDB(lazydb.LazyDB): #FIXME: this method is a quick hack around repo_info.indexuri.get_uri() def get_repo_url(self, repo): + if not self.has_repo(repo): + raise RepoError(_("Repository %s does not exist.") % repo) + urifile_path = pisi.util.join_path(ctx.config.index_dir(), repo, "uri") uri = open(urifile_path, "r").read() return uri.rstrip()