def setDefaults(self):
        for specialKey in ["database","host"]:
            try:
                if isinstance(self.outside_dictionary[specialKey],basestring):
                    #coerce strings to list:
                    self.outside_dictionary[specialKey] = [self.outside_dictionary[specialKey]]
            except __HOLE__:
                #It's OK not to define host.
                if specialKey=="host":
                    pass
            
        if 'host' not in self.outside_dictionary:
            #Build a hostlist: usually just localhost a bunch of times.
            self.outside_dictionary['host']  = hostlist(self.outside_dictionary['database'])

        for (target, dest) in [("database","host"),("host","database")]:
            #Expand out so you can search for the same database on multiple databases, or multiple databases on the same host.
            if len(self.outside_dictionary[target])==1 and len(self.outside_dictionary[dest]) != 1:
                self.outside_dictionary[target] = self.outside_dictionary[target] * len(self.outside_dictionary[dest])
dataset/ETHPy150Open Bookworm-project/BookwormDB/bookwormDB/MetaWorm.py/MetaQuery.setDefaults