'Creates an UpdateRecord to be submitted to all subscribers of an Object'

def create_notification(self, action='update', author=None, *args, **kwargs):

    if (not (self.subscribers.all().count() or author)):
        return None
    notification = UpdateRecord()
    updated = False
    if (action == 'delete'):
        notification.format_message = '%s    "%s"    deleted.'
        notification.set_format_strings([unicode(self.get_human_type(translate=False)), unicode(self)])
        notification.record_type = 'delete'
        updated = True
    elif (action == 'm2m'):
        notification.record_type = 'update'
        if (('field' in kwargs) and ('original' in kwargs) and ('updated' in kwargs)):
            if kwargs['updated']:
                updated_text = ''
                for obj in kwargs['updated']:
                    updated_text += ('<a    href="%s"    class="popup-link">%s</a>' % (obj.get_absolute_url(), unicode(obj)))
                    if (kwargs['updated'].index(obj) < (len(kwargs['updated']) - 1)):
                        updated_text += ',    '
            else:
                updated_text = 'None'
            field = unicode(kwargs['field'])
            if (field == 'assigned'):
                notification.format_message = '%s    assigned    to    %s.<br    />'
                notification.set_format_strings([self.get_human_type(translate=False), updated_text])
                notification.save()
                for obj in kwargs['updated']:
                    if (isinstance(obj, AccessEntity) or isinstance(obj, User)):
                        notification.recipients.add(obj)
                        self.subscribers.add(obj)
                        try:
                            if (not obj.has_permission(self, mode='w')):
                                self.full_access.add(obj)
                        except:
                            pass
                    else:
                        try:
                            notification.recipients.add(obj.related_user)
                            self.subscribers.add(obj.related_user)
                        except:
                            pass
                        try:
                            if (not obj.related_user.has_permission(self, mode='w')):
                                self.full_access.add(obj.related_user)
                        except:
                            pass
            else:
                notification.format_message = '%s    changed    to    "%s".<br    />'
                notification.set_format_strings([field.replace('_', '    ').capitalize(), updated_text])
            updated = True
    elif (action == 'create'):
        notification.format_message = '%s    created.'
        notification.set_format_strings([unicode(self.get_human_type(translate=False))])
        notification.record_type = 'create'
        updated = True
    else:
        notification.record_type = 'update'
        fields = self.get_field_names()
        original = self.get_related_object()
        notification.format_message = ''
        strings = []
        for field in fields:
            if hasattr(getattr(self, field), 'all'):
                continue
            if (field in getattr(settings, 'HARDTREE_UPDATE_BLACKLIST', [])):
                continue
            if ('password' in field):
                continue
            current = self.get_field_value(field)
            before = original.get_field_value(field)
            if (current != before):
                if ('_display' in field):
                    field = field.replace('_display', '')
                if isinstance(self._meta.get_field(field), models.TextField):
                    notification.format_message += '%s    changed.<br    />'
                    strings.extend([unicode(field).replace('_', '    ').capitalize()])
                elif isinstance(self._meta.get_field(field), models.DateTimeField):
                    notification.format_message += '%s    changed    from    "%s"    to    "%s".<br    />'
                    localeformat = 'j    F    Y,    H:i'
                    strings.extend([unicode(field).replace('_', '    ').capitalize(), unicode(djangodate(before, localeformat)), unicode(djangodate(current, localeformat))])
                else:
                    notification.format_message += '%s    changed    from    "%s"    to    "%s".<br    />'
                    strings.extend([unicode(field).replace('_', '    ').capitalize(), unicode(before), unicode(current)])
                updated = True
        notification.set_format_strings(strings)
    if self.trash:
        try:
            old_object = Object.objects.get(pk=self.id)
            if (not old_object.trash):
                notification.format_message += '    %s    moved    to    <a    href="%s">%s</a>'
                strings = notification.get_format_strings()
                strings.extend([unicode(self.get_human_type(translate=False)), reverse('core_trash'), 'Trash'])
                notification.set_format_strings(strings)
                notification.record_type = 'delete'
                updated = True
        except Exception:
            pass
    if ('body' in kwargs):
        notification.body = kwargs['body']
        updated = True
    if (not updated):
        return None
    notification.url = self.get_absolute_url()
    notification.author = author
    if (action != 'delete'):
        notification.sender = self
    notification.save()
    notification.about.add(self)
    return notification
