[IMP] throw exception when no toke is available

This commit is contained in:
Gery Debongnie 2014-07-15 14:38:36 +02:00
parent 433d8bc67c
commit 7261f5f479

View File

@ -193,6 +193,8 @@ class runbot_repo(osv.osv):
def github(self, cr, uid, ids, url, payload=None, delete=False, context=None):
"""Return a http request to be sent to github"""
for repo in self.browse(cr, uid, ids, context=context):
if not repo.token:
raise Exception('Repository does not have a token to authenticate')
match_object = re.search('([^/]+)/([^/]+)/([^/]+)', repo.base)
if match_object:
url = url.replace(':owner', match_object.group(2))