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
@@ -30,13 +30,12 @@ class UserKey( GithubObject.GithubObject ):
return self._NoneIfNotSet( self._verified )
def delete( self ):
status, headers, data = self._request(
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
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
@@ -46,13 +45,12 @@ class UserKey( 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.url,
None,
post_parameters
)
self._checkStatus( status, data )
self._useAttributes( data )
def _initAttributes( self ):