(self, docid, **params)
return doc
Get document from database

        Args:
        @param docid: str, document id to retrieve
        @param wrapper: callable. function that takes dict as a param.
        Used to wrap an object.
        @param **params: See doc api for parameters to use:
        http://wiki.apache.org/couchdb/HTTP_Document_API

        @return: dict, representation of CouchDB document as
         a dict.
Get document from database
Get document from database
def debug_open_doc(self, docid, **params):
        """Get document from database

        Args:
        @param docid: str, document id to retrieve
        @param wrapper: callable. function that takes dict as a param.
        Used to wrap an object.
        @param **params: See doc api for parameters to use:
        http://wiki.apache.org/couchdb/HTTP_Document_API

        @return: dict, representation of CouchDB document as
         a dict.
        """
        start = datetime.utcnow()

        ############################
        #Start Database.open_doc
        wrapper = None
        if "wrapper" in params:
            wrapper = params.pop("wrapper")
        elif "schema" in params:
            schema = params.pop("schema")
            if not hasattr(schema, "wrap"):
                raise TypeError("invalid schema")
            wrapper = schema.wrap

        docid = resource.escape_docid(docid)
        error = None
        try:
            doc = self.res.get(docid, **params).json_body
        except ResourceNotFound as ex:
            error = ex
            doc = {}
        #############################

        #############################
        #Debug Panel data collection
        stop = datetime.utcnow()
        duration = ms_from_timedelta(stop - start)
        stacktrace = tidy_stacktrace(traceback.extract_stack())

        if wrapper is not None:
            view_path_display = "GET %s" % wrapper.__self__._doc_type
        else:
            view_path_display = "Raw GET"

        q = {
                'view_path': view_path_display,
                'duration': duration,
                'params': params,
                'stacktrace': stacktrace,
                'start_time': start,
                'stop_time': stop,
                'is_slow': (duration > SQL_WARNING_THRESHOLD),
                'total_rows': 1,
                'response': 200 if error is None else 404,
                'doc_type': doc.get('doc_type', '[unknown]'),
                'doc_id': docid,
            }
        self._queries.append(q)

        #end debug panel data collection
        ################################


        ##################################
        #Resume original Database.open_doc
        if error is not None:
            raise error

        if wrapper is not None:
            if not callable(wrapper):
                raise TypeError("wrapper isn't a callable")
            return wrapper(doc)

        return doc
def debug_open_doc ( self , docid , * * params ) : start = datetime . utcnow ( ) ############################ #Start Database.open_doc wrapper = None if "wrapper" in params : wrapper = params . pop ( "wrapper" ) elif "schema" in params : schema = params . pop ( "schema" ) if not hasattr ( schema , "wrap" ) : raise TypeError ( "invalid schema" ) wrapper = schema . wrap docid = resource . escape_docid ( docid ) error = None try : doc = self . res . get ( docid , * * params ) . json_body except ResourceNotFound as ex : error = ex doc = { } ############################# ############################# #Debug Panel data collection stop = datetime . utcnow ( ) duration = ms_from_timedelta ( stop - start ) stacktrace = tidy_stacktrace ( traceback . extract_stack ( ) ) if wrapper is not None : view_path_display = "GET %s" % wrapper . __self__ . _doc_type else : view_path_display = "Raw GET" q = { 'view_path' : view_path_display , 'duration' : duration , 'params' : params , 'stacktrace' : stacktrace , 'start_time' : start , 'stop_time' : stop , 'is_slow' : ( duration > SQL_WARNING_THRESHOLD ) , 'total_rows' : 1 , 'response' : 200 if error is None else 404 , 'doc_type' : doc . get ( 'doc_type' , '[unknown]' ) , 'doc_id' : docid , } self . _queries . append ( q ) #end debug panel data collection ################################ ################################## #Resume original Database.open_doc if error is not None : raise error if wrapper is not None : if not callable ( wrapper ) : raise TypeError ( "wrapper isn't a callable" ) return wrapper ( doc ) return doc