From 66aa372874b17891ecc0c2f13f6414e51855c61b Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Mon, 13 Feb 2012 21:14:48 +0100 Subject: [PATCH] Use status requests for DELETE --- github/GithubObject.UnitTest.py | 1 + github/GithubObject.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/github/GithubObject.UnitTest.py b/github/GithubObject.UnitTest.py index dab7c4f9..f8bcacfb 100644 --- a/github/GithubObject.UnitTest.py +++ b/github/GithubObject.UnitTest.py @@ -32,6 +32,7 @@ class TestCaseWithGithubTestObject( unittest.TestCase ): return self.g.expect._dataRequest( "PATCH", url, data ) def expectDelete( self, url ): + return self.g.expect._statusRequest( "DELETE", url ) return self.g.expect._dataRequest( "DELETE", url ) class GithubObjectWithOnlySimpleScalarAttributes( TestCaseWithGithubTestObject ): diff --git a/github/GithubObject.py b/github/GithubObject.py index 280e201a..d4b55565 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -63,7 +63,7 @@ class ExtendedListAttribute: def __call__( self, toBeDeleted ): assert( isinstance( toBeDeleted, self.__type ) ) - self.__obj._github._dataRequest( "DELETE", self.__obj._baseUrl + "/" + self.__attributeName + "/" + toBeDeleted._identity ) + self.__obj._github._statusRequest( "DELETE", self.__obj._baseUrl + "/" + self.__attributeName + "/" + toBeDeleted._identity ) class RemoveDefinition: def __init__( self, attributeName, removeName, type ): @@ -184,7 +184,7 @@ class Deletable: self.__obj = obj def __call__( self ): - self.__obj._github._dataRequest( "DELETE", self.__obj._baseUrl ) + self.__obj._github._statusRequest( "DELETE", self.__obj._baseUrl ) class AttributeDefinition: def getValueFromRawValue( self, obj, rawValue ): @@ -257,7 +257,7 @@ def GithubObject( className, *attributePolicies ): self.__fetchAttribute( attributeName ) return self.__attributes[ attributeName ] else: - raise AttributeError() + raise AttributeError( attributeName ) def _updateAttributes( self, attributes ): for attributeName, attributeValue in attributes.iteritems():