示例#1
0
def check_slug(slug):
    """If the title is incorrect (only special chars so slug is empty)

    :param slug: slug to test
    :type slug; str
    :return: `True` if slug is valid, false otherwise
    :rtype: bool
    """

    if not VALID_SLUG.match(slug):
        return False

    if slug.replace("-", "").replace("_", "") == "":
        return False

    if len(slug) > settings.ZDS_APP['content']['maximum_slug_size']:
        return False

    return True
示例#2
0
def check_slug(slug):
    """
    If the title is incorrect (only special chars so slug is empty).

    :param slug: slug to test
    :type slug: str
    :return: `True` if slug is valid, false otherwise
    :rtype: bool
    """

    if not VALID_SLUG.match(slug):
        return False

    if not slug.replace('-', '').replace('_', ''):
        return False

    if len(slug) > settings.ZDS_APP['content']['maximum_slug_size']:
        return False

    return True