def main(self):
        """
        A replacable main function.  If you wish to use the data loader features of this
        class, you'll need to edit the code at the bottom of this file.
        
        This one is basically connects to the database and then attempts to fire up the
        pairing process.
        
        GNOME doesn't use hierarchical project descriptions, so this should not be nearly
        as big of a deal that we force the parent to be none.
        """
        options, args = self.parser.parse_args()
        
        self.log.setLevel(getattr(logging, options.loglevel.upper()))

        # connect to the database
        self.log.debug("connecting to database: %s - debug=%s", options.uri, options.debug)
        connect(options.uri, debug=options.debug, autocommit=False)
    
        try:
            self.community = Community.select(Community.q.name==options.community)[0] # pylint: disable-msg=E1101
        except IndexError:
            self.log.error("Unable to find community \"%s\"", options.community)
            sys.exit()
        
        self.unknowncorp = Corporation.select(Corporation.q.name=="unknown")[0] # pylint: disable-msg=E1101
        
        projects = MasterProject.select(AND(MasterProject.q.communityID==self.community.id, # pylint: disable-msg=E1101
                                            MasterProject.q.parentID==None)) # pylint: disable-msg=E1101
        for project in projects:
            self.link_project(project)
    def get_corporation(self, corporation_name):
        """
        Finds the corporation with the given name, creating it if necessary

        @param community_name: the name of the corporation to example (eg "IBM", "RedHat")
        @return: an SQLObject Corporation entity
        @rtype: dbojects.Corporation
        """
        comm = Corporation.select(Corporation.q.name == corporation_name) #pylint: disable-msg=E1101
        if comm.count():
            self.corporation_cache[corporation_name] = comm[0]
            return comm[0]
        else:
            self.corporation_cache[corporation_name] = Corporation(name=corporation_name)
            return self.corporation_cache[corporation_name]