Exemplo n.º 1
0
def isLinked(obj):
    """Check if the given content object is linked from another one."""
    log_deprecated(
        "utils.isLinked is deprecated, you should use plone.app.linkintegrity.utils.hasIncomingLinks"
    )  # noqa
    from plone.app.linkintegrity.utils import hasIncomingLinks
    return hasIncomingLinks(obj)
Exemplo n.º 2
0
Arquivo: utils.py Projeto: dtgit/dtedu
def normalizeString(text, context=None, encoding=None, relaxed=False):
    assert (context is not None) or (encoding is not None), \
           'Either context or encoding must be provided'
    # Make sure we are dealing with a stringish type
    if not isinstance(text, basestring):
        # This most surely ends up in something the user does not expect
        # to see. But at least it does not break.
        text = repr(text)

    # Make sure we are dealing with a unicode string
    if not isinstance(text, unicode):
        if encoding is None:
            encoding = getSiteEncoding(context)
        text = unicode(text, encoding)

    if not relaxed:
        return queryUtility(IIDNormalizer).normalize(text)

    # BBB To be removed in Plone 3.5
    log_deprecated("The relaxed mode of normalizeString is deprecated and will "
                   "be removed in Plone 3.5. Please use either the url or file "
                   "name normalizer from the plone.i18n package instead.")

    request = getattr(context, 'REQUEST', None)
    # If we have a request, get the preferred user normalizer
    if request is not None:
        return IUserPreferredFileNameNormalizer(request).normalize(text)

    return queryUtility(IFileNameNormalizer).normalize(text)
Exemplo n.º 3
0
def isLinked(obj):
    """Check if the given content object is linked from another one."""
    log_deprecated("utils.isLinked is deprecated, you should use plone.app.linkintegrity.utils.hasIncomingLinks")  # noqa
    from plone.app.linkintegrity.utils import hasIncomingLinks
    return hasIncomingLinks(obj)