Factorize checking of status

This commit is contained in:
Vincent Jacques
2012-06-03 11:33:37 +02:00
parent a77b972dd5
commit d261b4ba46
27 changed files with 196 additions and 367 deletions
+2 -4
View File
@@ -38,13 +38,12 @@ class RepositoryKey( GithubObject.GithubObject ):
return self._NoneIfNotSet( self._verified )
def delete( self ):
status, headers, data = self._request(
headers, data = self._requester.requestAndCheck(
"DELETE",
self.__customUrl,
None,
None
)
self._checkStatus( status, data )
def edit( self, title = GithubObject.NotSet, key = GithubObject.NotSet ):
assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title
@@ -54,13 +53,12 @@ class RepositoryKey( GithubObject.GithubObject ):
post_parameters[ "title" ] = title
if key is not GithubObject.NotSet:
post_parameters[ "key" ] = key
status, headers, data = self._request(
headers, data = self._requester.requestAndCheck(
"PATCH",
self.__customUrl,
None,
post_parameters
)
self._checkStatus( status, data )
self._useAttributes( data )
def _initAttributes( self ):