def projects_database_update_success(self, aliases_after_update,
                                         projects_db):
        """
        Display the results of the projects/aliases database update. We need
        the projects db to extract the name of the projects / activities.
        """
        def show_aliases(aliases):
            """
            Display the given list of aliases in the following form:

            my_alias
                project name / activity name

            The aliases parameter is just a list of aliases, the mapping is
            extracted from the aliases_after_update parameter, and the
            project/activity names are looked up in the projects db.
            """
            for alias in aliases:
                mapping = aliases_after_update[alias]
                (project, activity) = projects_db.mapping_to_project(mapping)

                self.msg("%s\n\t%s / %s" % (
                    alias, project.name if project else "?",
                    activity.name if activity else "?"
                ))

        self.msg("Projects database updated successfully.")

        deleted_aliases = (set(aliases_database.aliases.keys()) -
                           set(aliases_after_update.keys()))
        added_aliases = (set(aliases_after_update.keys()) -
                         set(aliases_database.aliases.keys()))

        modified_aliases = set()
        for alias, mapping in six.iteritems(aliases_after_update):
            if (alias in aliases_database
                    and aliases_database[alias][:2] != mapping[:2]):
                modified_aliases.add(alias)

        if added_aliases:
            self.msg("\nThe following shared aliases have been added:\n")
            show_aliases(added_aliases)

        if deleted_aliases:
            self.msg("\nThe following shared aliases have been removed:\n")
            for alias in deleted_aliases:
                self.msg(alias)

        if modified_aliases:
            self.msg("\nThe following shared aliases have been updated:\n")
            show_aliases(modified_aliases)
def projects_database_update_success ( self , aliases_after_update , projects_db ) : def show_aliases ( aliases ) : for alias in aliases : mapping = aliases_after_update [ alias ] ( project , activity ) = projects_db . mapping_to_project ( mapping ) self . msg ( "%s\n\t%s / %s" % ( alias , project . name if project else "?" , activity . name if activity else "?" ) ) self . msg ( "Projects database updated successfully." ) deleted_aliases = ( set ( aliases_database . aliases . keys ( ) ) - set ( aliases_after_update . keys ( ) ) ) added_aliases = ( set ( aliases_after_update . keys ( ) ) - set ( aliases_database . aliases . keys ( ) ) ) modified_aliases = set ( ) for alias , mapping in six . iteritems ( aliases_after_update ) : if ( alias in aliases_database and aliases_database [ alias ] [ : 2 ] != mapping [ : 2 ] ) : modified_aliases . add ( alias ) if added_aliases : self . msg ( "\nThe following shared aliases have been added:\n" ) show_aliases ( added_aliases ) if deleted_aliases : self . msg ( "\nThe following shared aliases have been removed:\n" ) for alias in deleted_aliases : self . msg ( alias ) if modified_aliases : self . msg ( "\nThe following shared aliases have been updated:\n" ) show_aliases ( modified_aliases )
Display the results of the projects/aliases database update. We need
        the projects db to extract the name of the projects / activities.