diff rhodecode/controllers/api/api.py @ 1508:4aba7be311e8 beta

API added checks for a valid repository on pull command Added pre-check if repository have a remote_uri defines before pulling bugfix with no default arguments on api function added traceback when unhandled exception occurs on API
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 02 Oct 2011 02:06:23 +0200
parents 256e729a94cd
children 3338a0994472
line wrap: on
line diff
--- a/rhodecode/controllers/api/api.py	Sat Oct 01 21:51:28 2011 +0300
+++ b/rhodecode/controllers/api/api.py	Sun Oct 02 02:06:23 2011 +0200
@@ -5,7 +5,7 @@
 from rhodecode.lib.auth import HasPermissionAllDecorator
 from rhodecode.model.scm import ScmModel
 
-from rhodecode.model.db import User, UsersGroup
+from rhodecode.model.db import User, UsersGroup, Repository
 
 log = logging.getLogger(__name__)
 
@@ -36,6 +36,9 @@
         :param repo:
         """
 
+        if Repository.is_valid(repo) is False:
+            raise JSONRPCError('Unknown repo "%s"' % repo)
+        
         try:
             ScmModel().pull_changes(repo, self.rhodecode_user.username)
             return 'Pulled from %s' % repo