def _save_and_approve(self, request, obj):
    site = self.get_site()
    commit_model = site.get_version_tracker_model().commit_model
    if ((not site.has_add_permission(request, obj, commit_model)) or (not site.has_change_permission(request, commit_model))):
        messages.error(request, _("You don't have permission to approve commits."))
    else:
        if obj.root_node.has_changes():
            obj.root_node.commit(request.user)
        obj.root_node.head.reviewedversioncommit.approve(request.user)
        obj.root_node.head.reviewedversioncommit.save()
        obj.status = CONTENT_STATUS_PUBLISHED
def _save_and_approve(self, request, obj):
    site = self.get_site()
    commit_model = site.get_version_tracker_model().commit_model
    if ((not site.has_add_permission(request, obj, commit_model)) or (not site.has_change_permission(request, commit_model))):
        messages.error(request, _("You don't have permission to approve commits."))
    else:
        if obj.root_node.has_changes():
            obj.root_node.commit(request.user)
        obj.root_node.head.reviewedversioncommit.approve(request.user)
        obj.root_node.head.reviewedversioncommit.save()
        obj.status = CONTENT_STATUS_PUBLISHED