def get_ticket_changes(self, req, ticket, action):
        if action == 'resolve' and \
                req.args and 'action_resolve_resolve_resolution' in req.args:
            old_milestone = ticket._old.get('milestone') or None
            user_milestone = ticket['milestone'] or None
            # If there's no user defined milestone, we try to set it
            # using the defined resolution -> milestone mapping.
            if old_milestone is None:
                new_status = req.args['action_resolve_resolve_resolution']
                new_milestone = self.__get_new_milestone(ticket, action,
                                                         new_status)
                # ... but we don't reset it to None unless it was None
                if new_milestone is not None or user_milestone is None:
                    try:
                        Milestone(self.env, new_milestone)
                    except ResourceNotFound:
                        add_warning(req, _("Milestone %(name)s does "
                                           "not exist.", name=new_milestone))
                    else:
                        self.log.info('changed milestone from %s to %s',
                                      old_milestone, new_milestone)
                        return {'milestone': new_milestone}
        return {}
dataset/ETHPy150Open edgewall/trac/sample-plugins/workflow/MilestoneOperation.py/MilestoneOperation.get_ticket_changes/original