Ejemplo n.º 1
0
# some BBB imports
from zope.deferredimport import deprecatedFrom

deprecatedFrom('The old style rating views are no longer intended to be used.'
               'Use the aggregator and rating views instead.  These views will '
               'go away in version 1.1',
               'contentratings.browser.bbb', 'EditorialRatingView',
               'EditorialRatingSetView', 'UserRatingView', 'UserRatingSetView',
               'MacroProvider')
Ejemplo n.º 2
0
from zope.interface import Interface
from zope.deferredimport import deprecatedFrom

class IRatingView(Interface):
    """A Marker indicating a rating view"""

class IAnonymousSession(Interface):

    def get_anon_key(request):
        """Generates a unique key for the current browser to ensure
        anonymous ratings can be restricted"""

deprecatedFrom('The old style rating views are no longer intended to be used.'
               'Use the aggregator and rating views instead.  This interface '
               'will go away in version 1.1',
               'contentratings.browser.bbb.interfaces', 'IEditorialRatingView')
Ejemplo n.º 3
0
from zope.deferredimport import deprecatedFrom
deprecatedFrom(
    "Import from ZPublisher.xmlrpc instead",
    'ZPublisher.xmlrpc',
    'Response',
    'is_xmlrpc_response',
    'response',
    'dump_instance',
    'parse_input',
    'WRAPPERS',
)
Ejemplo n.º 4
0
from zope.interface import Interface
from zope.deferredimport import deprecatedFrom


class IRatingView(Interface):
    """A Marker indicating a rating view"""


class IAnonymousSession(Interface):
    def get_anon_key(request):
        """Generates a unique key for the current browser to ensure
        anonymous ratings can be restricted"""


deprecatedFrom(
    'The old style rating views are no longer intended to be used.'
    'Use the aggregator and rating views instead.  This interface '
    'will go away in version 1.1', 'contentratings.browser.bbb.interfaces',
    'IEditorialRatingView')
Ejemplo n.º 5
0
from datetime import datetime
from persistent import Persistent
from zope.interface import implements
from zope.deferredimport import deprecatedFrom
from contentratings.interfaces import IRating

_marker = []

deprecatedFrom(
    'Rating categories should be created using the category '
    'factory or the zcml directive.  The UserRating and '
    'EditorialRating adapters are now deprecated and may behave '
    'differently.', 'contentratings.bbb', 'UserRating', 'EditorialRating')


class NPRating(float):
    """A non-persistent IRating object, for storages which store
    outside the ZODB, or which have no desire to annotate/mutate
    ratings."""
    implements(IRating)

    # No security on this
    __allow_access_to_unprotected_subobjects__ = True

    def __new__(cls, rating, userid=None):
        self = float.__new__(cls, rating)
        self.userid = userid
        self.timestamp = datetime.utcnow()
        return self

    def __repr__(self):
Ejemplo n.º 6
0
from zope.deferredimport import deprecatedFrom
deprecatedFrom(
    "Import from ZPublisher.xmlrpc instead",
    'ZPublisher.xmlrpc',
    'Response', 'is_xmlrpc_response', 'response',
    'dump_instance', 'parse_input', 'WRAPPERS',
)
Ejemplo n.º 7
0
from datetime import datetime
from persistent import Persistent
from zope.interface import implements
from zope.deferredimport import deprecatedFrom
from contentratings.interfaces import IRating

_marker = []

deprecatedFrom('Rating categories should be created using the category '
               'factory or the zcml directive.  The UserRating and '
               'EditorialRating adapters are now deprecated and may behave '
               'differently.',
               'contentratings.bbb', 'UserRating', 'EditorialRating')

class NPRating(float):
    """A non-persistent IRating object, for storages which store
    outside the ZODB, or which have no desire to annotate/mutate
    ratings."""
    implements(IRating)

    # No security on this
    __allow_access_to_unprotected_subobjects__ = True

    def __new__(cls, rating, userid=None):
        self = float.__new__(cls, rating)
        self.userid = userid
        self.timestamp = datetime.utcnow()
        return self

    def __repr__(self):
        return '<%s %r by %r on %s>' %(self.__class__.__name__, float(self),
Ejemplo n.º 8
0
    'ValidDatetime',
    'ValidRegEx',
    'ValidRegularExpression',
    'ValidSet',
    'ValidText',
    'ValidTextLine',
    'ValidURI',
    'Variant',
]

# BWC alias, not in __all__
DateTime = Datetime

deprecatedFrom(
    "Moved to nti.schema.schema",
    "nti.schema.schema",
    'SchemaConfigured',
)


def _do_set(self, context, value, cls, factory):
    try:
        event = factory(value, self.__name__, context)
        notify(event)
        value = event.object
        super(cls, self).set(context, value)
    except sch_interfaces.ValidationError as e: # pragma: no cover
        # This shouldn't happen, set() doesn't typically validate.
        self._reraise_validation_error(e, value) # pylint:disable=protected-access

def __make_set(cls, eventfactory):
Ejemplo n.º 9
0
    unregister_mimetype(context, 'text/x-tinymce-output-html')
    unregister_transform_policy(context, 'text/x-safe-html')
    register_transform_policy(context, "text/x-html-safe", "html_to_plone_outputfilters_html")


def importVarious(context):
    if context.readDataFile('portal-tinymce.txt') is None:
        return
    site = context.getSite()
    add_editor(site)


def unregisterUtility(context):
    my_utility = getUtility(ITinyMCE)
    context.getSiteManager().unregisterUtility(my_utility, ITinyMCE)
    del my_utility

    transaction.commit()

# BBB deprecated in Plone 4.1
deprecatedFrom("Please import from plone.outputfilters.setuphandlers instead.",
               'plone.outputfilters.setuphandlers',
               'register_mimetype',
               'unregister_mimetype',
               'register_transform',
               'unregister_transform',
               'register_transform_policy',
               'unregister_transform_policy',
               'install_mimetype_and_transforms',
               )
Ejemplo n.º 10
0
            for idx, v in enumerate(m):
                if _is_sequence(v):
                    if not isinstance(v, list):
                        m[idx] = list(v)
                elif not isinstance(v, collections.Mapping):
                    if not isinstance(v, _primitives):
                        m[idx] = None
            values = m
        else:
            values = ()
        for x in values:
            _clean(x)

    if _is_sequence(ext) and not isinstance(ext, list):
        ext = list(ext)
    _clean(ext)
    return ext


deferredimport.initialize()
deferredimport.deprecatedFrom(
    "Import from .interfaces",
    "nti.externalization.interfaces",
    "StandardExternalFields",
    "StandardInternalFields",
)

deferredimport.deprecatedFrom("This is not meant to be manually used.",
                              "nti.externalization.externalization.replacers",
                              "DevmodeNonExternalizableObjectReplacer")
Ejemplo n.º 11
0
    """
    # Remove all existing skin declarations (commonly the default skin).
    ifaces = [
        iface for iface in directlyProvidedBy(request)
        if not IBrowserSkinType.providedBy(iface)
    ]
    # Add the new skin.
    ifaces.append(skin)
    directlyProvides(request, *ifaces)
    zope.event.notify(SkinChangedEvent(request))


class SkinChangedEvent(object):

    zope.interface.implements(ISkinChangedEvent)

    def __init__(self, request):
        self.request = request


deprecatedFrom(
    'This name has moved to zope.httpform.typeconv.'
    'zope.httpform.typeconv', 'field2string', 'field2text', 'field2required',
    'field2int', 'field2float', 'field2long', 'field2tokens', 'field2lines',
    'field2boolean', 'type_converters', 'get_converter',
    'registerTypeConverter')

deprecatedFrom(
    'This name has moved to zope.httpform.parser.'
    'zope.httpform.parser', 'Record', 'FileUpload')
Ejemplo n.º 12
0
        This is determined by `SC_SCHEMAS` and defaults to `providedBy(self)`.
        """
        spec = self.SC_SCHEMAS
        return spec or providedBy(self)

class PermissiveSchemaConfigured(SchemaConfigured):
    """
    A mixin subclass of :class:`SchemaConfigured` that allows
    for extra keywords (those not defined in the schema) to silently be ignored.
    This is an aid to evolution of code and can be helpful in testing.

    To allow for one-by-one conversions and updates, this class defines an attribute
    ``SC_PERMISSIVE``, defaulting to True, that controls this behaviour.
    """

    SC_PERMISSIVE = True

    def __init__(self, **kwargs):
        if not self.SC_PERMISSIVE:
            super(PermissiveSchemaConfigured, self).__init__(**kwargs)
        else:
            _schema = schemadict(self.sc_schema_spec())
            kwargs = {k: kwargs[k] for k in kwargs if k in _schema}
            super(PermissiveSchemaConfigured, self).__init__(**kwargs)


deprecatedFrom("Moved to nti.schema.eqhash",
               "nti.schema.eqhash",
               'EqHash',
               '_superhash')