Returns a Python object or a ProtocolError.
517748
def _message_to_payload(cls, message):
        ''''''
        try:
            return json.loads(message.decode())
        except UnicodeDecodeError:
            message = 'messages must be encoded in UTF-8'
        except json.JSONDecodeError:
            message = 'invalid JSON'
        raise cls._error(cls.PARSE_ERROR, message, True, None)
804118
def _get_a_code_object_from( thing ) :
    '''
    
    '''
    # If we were passed a Method wrapper, get its function
    if isinstance( thing, types.MethodType ) :
        thing = thing.__func__
    # If we were passed a property object, get its getter function
    # (no direct support for the fdel or fset functions)
    if hasattr( thing, 'fget' ) :
        thing = thing.fget
    # If we were passed, or now have, a function, get its code object.
    if isinstance( thing, types.FunctionType ) :
        thing = thing.__code__
    # We should now have a code object, or will never have it.
    return thing
567301
def get_object(self, queryset=None):
        
        try:
            obj = self.get_queryset()
        except self.model.DoesNotExist:
            raise Http404()
        self.check_object_permissions(self.request, obj)
        return obj
622681
def get_object_errors(self):
        
        if self._object_errors is None:
            self._object_errors = [{str(o): o.get_errors()}
                                   for o in self.objects()
                                   if o.has_error()]

        return self._object_errors
645970
def coerce(cls, arg):
        """"""
        try:
            return cls(arg).value
        except (ValueError, TypeError):
            raise InvalidParameterDatatype("%s coerce error" % (cls.__name__,))
305253
def get_object(self):
        
        obj = super(PublishView, self).get_object()

        if not obj or not hasattr(obj, 'publish'):
            raise http.Http404

        return obj
841063
def _error_message(self):
        
        body = self._deserialize()
        return body.get('message', body) if isinstance(body, dict) else body
389193
def get_error(self, error):
        
        error_type = type(error)
        if error.error_type == ET_CLIENT:
            error_type_name = 'Client'
        else:
            error_type_name = 'Server'
        return {
            'type': error_type_name,
            'name': error_type.__name__,
            'prefix': getattr(error_type, '__module__', ''),
            'message': unicode(error),
            'params': error.args,
        }
521099
def get_object(self, request):
        
        pattern = request.GET.get('pattern', '')
        if len(pattern) < 3:
            raise ObjectDoesNotExist
        return pattern
1358909
def get_error(response):
    """"""

    errors = {
        400: BadRequestError,
        401: UnauthorizedError,
        403: AccessDeniedError,
        404: NotFoundError,
        429: RateLimitExceededError,
        500: ServerError,
        502: BadGatewayError,
        503: ServiceUnavailableError
    }

    error_class = HTTPError
    if response.status_code in errors:
        error_class = errors[response.status_code]

    return error_class(response)
297382
def get_object(request, pid):
    """"""
    sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid)
    content_type_str = d1_gmn.app.object_format_cache.get_content_type(
        sciobj.format.format
    )
    # Return local or proxied SciObj bytes
    response = django.http.StreamingHttpResponse(
        _get_sciobj_iter(sciobj), content_type_str
    )
    d1_gmn.app.views.headers.add_sciobj_properties_headers_to_response(response, sciobj)
    d1_gmn.app.event_log.log_read_event(pid, request)
    return response
1137339
def to_python(self, value):
        """"""
        if value is None or value == '':
            return value
        if isinstance(value, base.Version):
            return value
        if self.coerce:
            return base.Version.coerce(value, partial=self.partial)
        else:
            return base.Version(value, partial=self.partial)
92599
def get(cls, **kwargs):
        
        things = cls.filter(**kwargs)
        if len(things) > 1:
            # Raise an exception if more than one object is matched
            raise cls.MultipleObjectsReturned
        elif len(things) == 0:
            # Rase an exception if no objects were matched
            raise cls.DoesNotExist
        return things[0]
612189
def get_connection(self, from_obj, to_obj):
        
        self._validate_ctypes(from_obj, to_obj)
        try:
            return self.connections.get(from_pk=from_obj.pk, to_pk=to_obj.pk)
        except Connection.DoesNotExist:
            return None
642316
def check_failures(object)
      check object
    rescue CheckFailed => e
      return e.errors.map { |e| e.protocol_message }
    end
664013
def get_object(self, queryset=None):
        
        if queryset is None:
            queryset = self.get_queryset()

        # Take a GET parameter instead of URLConf variable.
        try:
            pk = long(self.request.GET[self.pk_url_kwarg])
        except (KeyError, ValueError):
            raise Http404("Invalid Parameters")
        queryset = queryset.filter(pk=pk)

        try:
            # Get the single item from the filtered queryset
            obj = queryset.get()
        except ObjectDoesNotExist as e:
            raise Http404(e)
        return obj
324988
def from_object(cls, obj):
        # type: (Any) -> UrlPath
        
        if isinstance(obj, UrlPath):
            return obj
        if isinstance(obj, _compat.string_types):
            return UrlPath.parse(obj)
        if isinstance(obj, PathParam):
            return UrlPath(obj)
        if isinstance(obj, (tuple, list)):
            return UrlPath(*obj)
        raise ValueError("Unable to convert object to UrlPath `%r`" % obj)