@register.filter(is_safe=True)
@stringfilter
def truncatechars(value, arg):
    """
    Truncates a string after a certain number of characters.

    Argument: Number of characters to truncate after.
    """
    try:
        length = int(arg)
    except __HOLE__: # Invalid literal for int().
        return value # Fail silently.
    return Truncator(value).chars(length)
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/template/defaultfilters.py/truncatechars