Example #1
0
def author_cache_key(m, i, author):
    """Cache key that discriminates on the user ID of the provided user
    (Plone user or string), and the hostname.

    The hostname is required because this cache key is used to cache generated
    URLs, which are dependent on the hostname that is used to access the
    system (might be localhost + SSH tunnel).
    """
    hostname = get_hostname(getRequest())
    if IPropertiedUser.providedBy(author) or IMemberData.providedBy(author):
        userid = author.getId()
    else:
        userid = author
    return (userid, hostname)
Example #2
0
def author_cache_key(m, i, author):
    """Cache key that discriminates on the user ID of the provided user
    (Plone user or string), and the hostname.

    The hostname is required because this cache key is used to cache generated
    URLs, which are dependent on the hostname that is used to access the
    system (might be localhost + SSH tunnel).
    """
    hostname = get_hostname(getRequest())
    if IPropertiedUser.providedBy(author) or IMemberData.providedBy(author):
        userid = author.getId()
    else:
        userid = author
    return (userid, hostname)
Example #3
0
def hostname_cache_key(m, *args, **kwargs):
    return get_hostname(getRequest())
Example #4
0
def hostname_cache_key(m):
    return get_hostname(getRequest())