Exemplo n.º 1
0
    def get_query( self, q, request ):

        """
        return a query set.  you also have access to request.user if needed.
        """

        # return reference
        query_set_OUT = None

        # declare variables
        me = "get_query"
        my_logger_name = ""
        person_name = ""
        match_count = -1
        name_part_list = None
        human_name = None
        
        # init logging info
        my_logger_name = "sourcenet.lookups.PersonLookup"
        
        # store q in a real variable
        person_name = q
        
        # output string passed in
        output_debug( "q = " + str( q ), method_IN = me, logger_name_IN = my_logger_name )

        # is the q a number and is it the ID of an contributor?
        query_set_OUT = self.get_instance_query( person_name, request, self.my_class )

        # got anything back?
        if ( query_set_OUT is None ):

            # No exact match for q as ID.  Try Person.find_person_from_name()
            query_set_OUT = Person.find_person_from_name( person_name )
            
        #-- END retrieval of QuerySet when no ID match. --#

        return query_set_OUT