Exemplo n.º 1
0
def comments_are_moderated(content_object):
    """
    Return whether comments are moderated for a given target object.
    """
    moderator = get_model_moderator(content_object.__class__)
    if moderator is None:
        return False

    # Check the 'auto_moderate_field', 'moderate_after',
    # by reusing the basic Django policies.
    return CommentModerator.moderate(moderator, None, content_object, None)
Exemplo n.º 2
0
def comments_are_moderated(content_object):
    """
    Return whether comments are moderated for a given target object.
    """
    moderator = get_model_moderator(content_object.__class__)
    if moderator is None:
        return False

    # Check the 'auto_moderate_field', 'moderate_after',
    # by reusing the basic Django policies.
    return CommentModerator.moderate(moderator, None, content_object, None)
Exemplo n.º 3
0
def comments_are_open(content_object):
    """
    Return whether comments are still open for a given target object.
    """
    moderator = get_model_moderator(content_object.__class__)
    if moderator is None:
        return True

    # Check the 'enable_field', 'auto_close_field' and 'close_after',
    # by reusing the basic Django policies.
    return CommentModerator.allow(moderator, None, content_object, None)
Exemplo n.º 4
0
def comments_are_open(content_object):
    """
    Return whether comments are still open for a given target object.
    """
    moderator = get_model_moderator(content_object.__class__)
    if moderator is None:
        return True

    # Check the 'enable_field', 'auto_close_field' and 'close_after',
    # by reusing the basic Django policies.
    return CommentModerator.allow(moderator, None, content_object, None)
Exemplo n.º 5
0
    def comments_are_moderated(self):
        """
        Check if comments are moderated
        """
        try:
            # Get the moderator which is installed for this model.
            mod = moderator._registry[self.__class__]
        except KeyError:
            return False

        # Check the 'auto_moderate_field', 'moderate_after',
        # by reusing the basic Django policies.
        return CommentModerator.moderate(mod, None, self, None)
Exemplo n.º 6
0
    def comments_are_open(self):
        """
        Check if comments are open
        """
        if not self.enable_comments or CommentModel is None:
            return False

        try:
            # Get the moderator which is installed for this model.
            mod = moderator._registry[self.__class__]
        except KeyError:
            return True

        # Check the 'enable_field', 'auto_close_field' and 'close_after',
        # by reusing the basic Django policies.
        return CommentModerator.allow(mod, None, self, None)
Exemplo n.º 7
0
def get_comments_are_moderated(instance):
    """
    Check if comments are moderated for the instance
    """
    if CommentModel is None:
        return False

    try:
        # Get the moderator which is installed for this model.
        mod = moderator._registry[instance.__class__]
    except KeyError:
        # No moderator = no moderation
        return False

    # Check the 'auto_moderate_field', 'moderate_after',
    # by reusing the basic Django policies.
    return CommentModerator.moderate(mod, None, instance, None)
Exemplo n.º 8
0
def get_comments_are_open(instance):
    """
    Check if comments are open for the instance
    """
    if CommentModel is None:
        return False

    try:
        # Get the moderator which is installed for this model.
        mod = moderator._registry[instance.__class__]
    except KeyError:
        # No moderator = no restrictions
        return True

    # Check the 'enable_field', 'auto_close_field' and 'close_after',
    # by reusing the basic Django policies.
    return CommentModerator.allow(mod, None, instance, None)
Exemplo n.º 9
0
def get_comments_are_moderated(instance):
    """
    Check if comments are moderated for the instance
    """
    if not IS_INSTALLED:
        return False

    try:
        # Get the moderator which is installed for this model.
        mod = moderator._registry[instance.__class__]
    except KeyError:
        # No moderator = no moderation
        return False

    # Check the 'auto_moderate_field', 'moderate_after',
    # by reusing the basic Django policies.
    return CommentModerator.moderate(mod, None, instance, None)
Exemplo n.º 10
0
def get_comments_are_open(instance):
    """
    Check if comments are open for the instance
    """
    if not IS_INSTALLED:
        return False

    try:
        # Get the moderator which is installed for this model.
        mod = moderator._registry[instance.__class__]
    except KeyError:
        # No moderator = no restrictions
        return True

    # Check the 'enable_field', 'auto_close_field' and 'close_after',
    # by reusing the basic Django policies.
    return CommentModerator.allow(mod, None, instance, None)