diff --git a/github/Consts.py b/github/Consts.py index 65b592ac..ea4b1830 100644 --- a/github/Consts.py +++ b/github/Consts.py @@ -24,15 +24,7 @@ # TODO: As of Thu Aug 21 22:40:13 (BJT) Chinese Standard Time 2013 # lots of consts in this project are explict # should realy round them up and reference them by consts - -################################################################################ -# Helper Function # -################################################################################ -def get(dic, key): - if key in dic: - return dic[key] - return None - +# EDIT: well, maybe :-) ################################################################################ # Request Header # diff --git a/github/GithubObject.py b/github/GithubObject.py index cd44bf45..b6d153dc 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -27,13 +27,12 @@ from __future__ import with_statement import datetime - -import GithubException - import pickle +import GithubException import Consts + class _NotSetType: def __repr__(self): return "NotSet" @@ -126,14 +125,14 @@ class GithubObject(object): ''' :type str ''' - return Consts.get(self._headers, Consts.RES_ETAG) + return self._headers.get(Consts.RES_ETAG) @property def last_modified(self): ''' :type str ''' - return Consts.get(self._headers, Consts.RES_LAST_MODIFED) + return self._headers.get(Consts.RES_LAST_MODIFED) def update(self): diff --git a/github/Requester.py b/github/Requester.py index 1b30b6fe..8072bca2 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -290,8 +290,8 @@ class Requester: requestHeaders["Authorization"] = self.__authorizationHeader def __conditional(self, requestHeaders, parameters): - etag = Consts.get(parameters, Consts.REQ_IF_NONE_MATCH) - last_modified = Consts.get(parameters, Consts.REQ_IF_MODIFIED_SINCE) + etag = parameters.get(Consts.REQ_IF_NONE_MATCH) + last_modified = parameters.get(Consts.REQ_IF_MODIFIED_SINCE) if etag is not None: requestHeaders[Consts.REQ_IF_NONE_MATCH] = etag del parameters[Consts.REQ_IF_NONE_MATCH]