def handle(self): proto = Protocol(self.rfile.read, self.wfile.write) command, args = proto.read_cmd() # switch case to handle the specific git command if command == 'git-upload-pack': cls = UploadPackHandler elif command == 'git-receive-pack': cls = ReceivePackHandler else: return h = cls(self.server.backend, self.rfile.read, self.wfile.write) h.handle()