This function is shared by GitInfoRefs and SmartHTTPRPCHandler WSGI classes.
        It does the same basic steps - figure out working path, git command etc.

        dataObj - dictionary
        Because the dataObj passed in is mutable, it's a pointer. Once this function returns,
        this object, as created by calling class, will have the free-form updated data.

        Returns non-None object if an error was triggered (and already prepared in start_response).

def basic_checks(self, dataObj, environ, start_response):
        '''
        This function is shared by GitInfoRefs and SmartHTTPRPCHandler WSGI classes.
        It does the same basic steps - figure out working path, git command etc.

        dataObj - dictionary
        Because the dataObj passed in is mutable, it's a pointer. Once this function returns,
        this object, as created by calling class, will have the free-form updated data.

        Returns non-None object if an error was triggered (and already prepared in start_response).
        '''
        selector_matches = (environ.get('wsgiorg.routing_args') or ([],{}))[1]

        # making sure we have a compatible git command
        git_command = selector_matches.get('git_command') or ''
        if git_command not in ['git-upload-pack', 'git-receive-pack']: # TODO: this is bad for future compatibility. There may be more commands supported then.
            return self.canned_handlers(environ, start_response, 'bad_request')

        # TODO: Add "public" to "dynamic local" path conversion hook ups here.

        #############################################################
        # making sure local path is a valid git repo folder
        #
        repo_path = os.path.abspath(
            os.path.join(
                self.content_path,
                (selector_matches.get('working_path') or '').decode('utf8').strip('/').strip('\\')
                )
            )
        _pp = os.path.abspath(self.content_path)

        # this saves us from "hackers" putting relative paths after repo marker.
        if not repo_path.startswith(_pp):
            return self.canned_handlers(environ, start_response, 'forbidden')

        if not self.has_access(
            environ = environ,
            repo_path = repo_path,
            git_command = git_command
            ):
            return self.canned_handlers(environ, start_response, 'forbidden')

        try:
            files = os.listdir(repo_path)
        except:
            files = []
        if not self.git_folder_signature.issubset([i.lower() for i in files]):
            if not ( self.repo_auto_create and git_command == 'git-receive-pack' ):
                return self.canned_handlers(environ, start_response, 'not_found')
            else:
                # 1. traverse entire post-prefix path and check that each segment
                #    If it is ( a git folder OR a non-dir object ) forbid autocreate
                # 2. Create folderS
                # 3. Activate a bare git repo
                _pf = _pp
                _dirs = repo_path[len(_pp):].strip(os.sep).split(os.sep) or ['']
                for _dir in _dirs:
                    _pf = os.path.join(_pf,_dir)
                    if not os.path.exists(_pf):
                        try:
                            os.makedirs(repo_path)
                        except:
                            return self.canned_handlers(environ, start_response, 'not_found')
                        break
                    elif not os.path.isdir(_pf) or self.git_folder_signature.issubset([i.lower() for i in os.listdir(_pf)]):
                        return self.canned_handlers(environ, start_response, 'forbidden')
                if subprocess.call('git init --quiet --bare "%s"' % repo_path, shell=True):
                    return self.canned_handlers(environ, start_response, 'execution_failed')
        #
        #############################################################

        dataObj['git_command'] = git_command
        dataObj['repo_path'] = repo_path
        return None