def __call__(self, environ, start_response):

        selector_matches = (environ.get('wsgiorg.routing_args') or ([],{}))[1]
        if selector_matches in 'working_path':
            path_info = selector_matches['working_path'].decode('utf8')
        else:
            path_info = environ.get('PATH_INFO', '').decode('utf8')

        scheme = environ.get('wsgi.url_scheme', 'http')
        host = environ.get('HTTP_HOST', 'localhost').decode('utf8')
        self.url = '%s://%s/%s' %(scheme, host, path_info)

        full_path = os.path.abspath(os.path.join(self.content_path, path_info.strip('/')))
        _pp = os.path.abspath(self.content_path)

        cmd, kwargs = self.get_params(environ)

        if not full_path.startswith(_pp):
            log.error('forbidden: %s' % full_path)
            return self.canned_handlers(environ, start_response, 'forbidden')

        if os.path.exists(full_path):
            mtime = os.stat(full_path).st_mtime
            etag, last_modified =  str(mtime), email.utils.formatdate(mtime)
        else:
            mtime, etag, last_modified = (None, None, None)

        headers = [
            ('Content-type', 'text/plain'),
            ('Date', email.utils.formatdate(time.time())),
            ('Last-Modified', last_modified),
            ('ETag', etag)
        ]

        fmap = {
            'read': handle_read,
            'new': handle_branch,
            'branch': handle_branch,
            'repos': handle_repos,
            'items': handle_items,
            'versions': handle_versions,
            'submodules': handle_submodules,
            'addSubmodule': handle_addSubmodule,
            'addVersion': handle_addVersion,
            'parent': handle_parent,
            'upload': handle_upload,
        }

        repo = get_repo_parent(full_path)
        if repo is None:
            repo = full_path
        item_path = full_path.split(str(repo))[-1][1:]

        #HACK: get the item, swap with repo
        if item_path and cmd != 'submodules':
            log.debug('full_path: %s, item_path: %s' % (full_path, item_path))
            items = repo.items(path=item_path)
            if items:
                repo = item = items[0]

        if cmd == 'data':
            data = repo.file()
            return self.package_response(data, environ, start_response)

        else:
            func = fmap.get(cmd, None)
            if func:
                response = func(repo, **kwargs)
            else:
                response = getattr(repo, cmd)(**kwargs)
        return self.json_response(response, environ, start_response)
dataset/ETHPy150Open rsgalloway/grit/grit/server/server.py/JSONServer.__call__/swapped operands of `in`