• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python deprecation.deprecated函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zope.deprecation.deprecated函数的典型用法代码示例。如果您正苦于以下问题:Python deprecated函数的具体用法?Python deprecated怎么用?Python deprecated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了deprecated函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _getFieldContext

 def _getFieldContext(self, uid):
     if uid is not None:
         rc = getToolByName(aq_inner(self.context), 'reference_catalog')
         return rc.lookupObject(uid)
     else:
         deprecated(FieldsView, missing_uid_deprecation)
         return aq_inner(self.context)
开发者ID:nacho22martin,项目名称:tesis,代码行数:7,代码来源:fields.py


示例2: remember

def remember(request, userid=_marker, **kw):
    """
    Returns a sequence of header tuples (e.g. ``[('Set-Cookie', 'foo=abc')]``)
    on this request's response.
    These headers are suitable for 'remembering' a set of credentials
    implied by the data passed as ``userid`` and ``*kw`` using the
    current :term:`authentication policy`.  Common usage might look
    like so within the body of a view function (``response`` is
    assumed to be a :term:`WebOb` -style :term:`response` object
    computed previously by the view code):

    .. code-block:: python

       from pyramid.security import remember
       headers = remember(request, 'chrism', password='123', max_age='86400')
       response = request.response
       response.headerlist.extend(headers)
       return response

    If no :term:`authentication policy` is in use, this function will
    always return an empty sequence. If used, the composition and
    meaning of ``**kw`` must be agreed upon by the calling code and
    the effective authentication policy.
    
    .. deprecated:: 1.6
        Renamed the ``principal`` argument to ``userid`` to clarify its
        purpose.
    """
    if userid is _marker:
        principal = kw.pop('principal', _marker)
        if principal is _marker:
            raise TypeError(
                'remember() missing 1 required positional argument: '
                '\'userid\'')
        else:
            deprecated(
                'principal',
                'The "principal" argument was deprecated in Pyramid 1.6. '
                'It will be removed in Pyramid 1.9. Use the "userid" '
                'argument instead.')
            userid = principal
    policy = _get_authentication_policy(request)
    if policy is None:
        return []
    return policy.remember(request, userid, **kw)
开发者ID:geniuslwf,项目名称:pyramid,代码行数:45,代码来源:security.py


示例3: kssValidateField

    def kssValidateField(self, fieldname, value, uid=None):
        '''Validate a given field
        '''
        # validate the field, actually

        if uid is not None:
            rc = getToolByName(aq_inner(self.context), 'reference_catalog')
            instance = rc.lookupObject(uid)
        else:
            deprecated(ValidationView, missing_uid_deprecation)
            instance = aq_inner(self.context)

        field = instance.getField(fieldname)
        if field.type in SKIP_KSSVALIDATION_FIELDTYPES:
            return self.render()
        error = field.validate(value, instance, {})
        # XXX
        if isinstance(error, str):
            error = error.decode('utf', 'replace')
        # replace the error on the page
        self.getCommandSet('atvalidation').issueFieldError(fieldname, error, warning_only=False)
        return self.render()
开发者ID:resa89,项目名称:imusite,代码行数:22,代码来源:validation.py


示例4: _integrate_plugins

def _integrate_plugins():
    """Integrate plugins to the context"""
    from airflow.plugins_manager import operators_modules
    for operators_module in operators_modules:
        sys.modules[operators_module.__name__] = operators_module
        globals()[operators_module._name] = operators_module

        ##########################################################
        # TODO FIXME Remove in Airflow 2.0

        if not os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
            from zope.deprecation import deprecated
            for _operator in operators_module._objects:
                operator_name = _operator.__name__
                globals()[operator_name] = _operator
                deprecated(
                    operator_name,
                    "Importing plugin operator '{i}' directly from "
                    "'airflow.operators' has been deprecated. Please "
                    "import from 'airflow.operators.[plugin_module]' "
                    "instead. Support for direct imports will be dropped "
                    "entirely in Airflow 2.0.".format(i=operator_name))
开发者ID:AdamUnger,项目名称:incubator-airflow,代码行数:22,代码来源:__init__.py


示例5: deprecate

def deprecate():
    """provide bbb for deprecations

    note: warnings are not printed unless it is enabled
    """
    from dexterity.membrane import behavior
    from dexterity.membrane.behavior import group
    from dexterity.membrane.behavior import user
    from dexterity.membrane.behavior import password

    behavior.membranegroup = deprecated(
        group,
        'module membranegroup is now named group.'
    )
    behavior.membraneuser = deprecated(
        user,
        'module membraneuser is now named user.'
    )
    behavior.membranepassword = deprecated(
        password,
        'module membranepassword is now named password.'
    )
开发者ID:sixfeetup,项目名称:dexterity.membrane,代码行数:22,代码来源:deprecation.py


示例6: kssValidateMultilanguageField

    def kssValidateMultilanguageField(self, fieldname, uid=None):
        '''Validate a given multilanguage field
        '''
        # validate the field, actually

        if uid is not None:
            rc = getToolByName(aq_inner(self.context), 'reference_catalog')
            instance = rc.lookupObject(uid)
        else:
            deprecated(ValidationView, missing_uid_deprecation)
            instance = aq_inner(self.context)

        field = instance.getField(fieldname)
        if field.type in SKIP_KSSVALIDATION_FIELDTYPES or \
           not IMultilanguageField.providedBy(field):
            return self.render()
        value = dict([(key[key.find('___')+3:-3], value) for key, value in self.request.form.items() if key.startswith(fieldname)])
        error = field.validate(value, instance, {}, REQUEST=self.request)
        # XXX
        if isinstance(error, str):
            error = error.decode('utf', 'replace')
        # replace the error on the page
        self.getCommandSet('atvalidation').issueFieldError(fieldname, error)
        return self.render()
开发者ID:Raptus,项目名称:raptus.multilanguagefields,代码行数:24,代码来源:validation.py


示例7: caller_package

    :term:`Chameleon` ZPT template using the template implied by the
    ``path`` argument.  The ``path`` argument may be a
    package-relative path, an absolute path, or a :term:`asset
    specification`.
    
    .. warning::

       This API is deprecated in :app:`Pyramid` 1.0.  Use
       :func:`pyramid.renderers.get_renderer` instead.
    """
    package = caller_package()
    factory = renderers.RendererHelper(name=path, package=package)
    return factory.get_renderer()

deprecated(
    'get_renderer',
    '(pyramid.chameleon_zpt.get_renderer is deprecated '
    'as of Pyramid 1.0; instead use pyramid.renderers.get_renderer)')

def get_template(path):
    """ Return the underyling object representing a :term:`Chameleon`
    ZPT template using the template implied by the ``path`` argument.
    The ``path`` argument may be a package-relative path, an absolute
    path, or a :term:`asset specification`.

    .. warning::

       This API is deprecated in :app:`Pyramid` 1.0.  Use
       the ``implementation()`` method of a template renderer retrieved via
       :func:`pyramid.renderers.get_renderer` instead.
    """
    package = caller_package()
开发者ID:HorizonXP,项目名称:pyramid,代码行数:32,代码来源:chameleon_zpt.py


示例8: static

class static(static_view):
    """ Backwards compatibility alias for
    :class:`pyramid.static.static_view`; it overrides that class' constructor
    to pass ``use_subpath=True`` by default.  This class is deprecated as of
    :app:`Pyramid` 1.1.  Use :class:`pyramid.static.static_view` instead
    (probably with a ``use_subpath=True`` argument).
    """
    def __init__(self, root_dir, cache_max_age=3600, package_name=None):
        if package_name is None:
            package_name = caller_package().__name__
        static_view.__init__(self, root_dir, cache_max_age=cache_max_age,
                             package_name=package_name, use_subpath=True)

deprecated(
    'static',
    'The "pyramid.view.static" class is deprecated as of Pyramid 1.1; '
    'use the "pyramid.static.static_view" class instead with the '
    '"use_subpath" argument set to True.')

def render_view_to_response(context, request, name='', secure=True):
    """ Call the :term:`view callable` configured with a :term:`view
    configuration` that matches the :term:`view name` ``name``
    registered against the specified ``context`` and ``request`` and
    return a :term:`response` object.  This function will return
    ``None`` if a corresponding :term:`view callable` cannot be found
    (when no :term:`view configuration` matches the combination of
    ``name`` / ``context`` / and ``request``).

    If `secure`` is ``True``, and the :term:`view callable` found is
    protected by a permission, the permission will be checked before calling
    the view function.  If the permission check disallows view execution
开发者ID:alertedsnake,项目名称:pyramid,代码行数:31,代码来源:view.py


示例9: ProposalSchema


class ProposalSchema(colander.MappingSchema):

    """Data structure for organizational information."""

    # TODO: check exact length restrictions

    budget = CurrencyAmount(missing=colander.required,
                            validator=colander.Range(min=0, max=50000))
    creator_participate = Boolean()
    location_text = SingleLine(validator=colander.Length(max=100))
    address = Text()

proposal_meta = sheet_meta._replace(isheet=IProposal,
                                    schema_class=ProposalSchema)


class IWorkflowAssignment(workflow.IWorkflowAssignment):

    """Marker interface for the kiezkassen workflow assignment sheet."""


deprecated('IWorkflowAssignment',
           'Backward compatible code use IWorkflowAssignment instead')


def includeme(config):
    """Register sheets."""
    add_sheet_to_registry(proposal_meta, config.registry)
开发者ID:robx,项目名称:adhocracy3.mercator,代码行数:28,代码来源:kiezkassen.py


示例10: getattr

    if title:
        return title
    item_id = getattr(obj, 'getId', None)
    if safe_callable(item_id):
        item_id = item_id()
    if item_id and not isIDAutoGenerated(context, item_id):
        return item_id
    if empty_value is _marker:
        empty_value = getEmptyTitle(context)
    return empty_value


def getSiteEncoding(context):
    return 'utf-8'
deprecated('getSiteEncoding',
           ('`getSiteEncoding` is deprecated. Plone only supports UTF-8 '
            'currently. This method always returns "utf-8"'))

# XXX portal_utf8 and utf8_portal probably can go away
def portal_utf8(context, str, errors='strict'):
    # Test
    unicode(str, 'utf-8', errors)
    return str


# XXX this is the same method as above
def utf8_portal(context, str, errors='strict'):
    # Test
    unicode(str, 'utf-8', errors)
    return str
开发者ID:ferewuz,项目名称:Products.CMFPlone,代码行数:30,代码来源:utils.py


示例11: BaseCookieSessionFactory

    )

    return BaseCookieSessionFactory(
        signed_serializer,
        cookie_name=cookie_name,
        max_age=max_age,
        path=path,
        domain=domain,
        secure=secure,
        httponly=httponly,
        samesite=samesite,
        timeout=timeout,
        reissue_time=reissue_time,
        set_on_exception=set_on_exception,
    )


check_csrf_origin = check_csrf_origin  # api
deprecated(
    'check_csrf_origin',
    'pyramid.session.check_csrf_origin is deprecated as of Pyramid '
    '1.9. Use pyramid.csrf.check_csrf_origin instead.',
)

check_csrf_token = check_csrf_token  # api
deprecated(
    'check_csrf_token',
    'pyramid.session.check_csrf_token is deprecated as of Pyramid '
    '1.9. Use pyramid.csrf.check_csrf_token instead.',
)
开发者ID:Pylons,项目名称:pyramid,代码行数:30,代码来源:session.py


示例12: deprecated

    """
    A function that calls :meth:`pyramid.request.Request.has_permission`
    and returns its result.
    
    .. deprecated:: 1.5
        Use :meth:`pyramid.request.Request.has_permission` instead.

    .. versionchanged:: 1.5a3
        If context is None, then attempt to use the context attribute of self;
        if not set, then the AttributeError is propagated.
    """    
    return request.has_permission(permission, context)

deprecated(
    'has_permission',
    'As of Pyramid 1.5 the "pyramid.security.has_permission" API is now '
    'deprecated.  It will be removed in Pyramd 1.8.  Use the '
    '"has_permission" method of the Pyramid request instead.'
    )


def authenticated_userid(request):
    """
    A function that returns the value of the property
    :attr:`pyramid.request.Request.authenticated_userid`.
    
    .. deprecated:: 1.5
       Use :attr:`pyramid.request.Request.authenticated_userid` instead.
    """        
    return request.authenticated_userid

deprecated(
开发者ID:Bedrock02,项目名称:Vigenere,代码行数:32,代码来源:security.py


示例13: object

from zope.interface import implementer


_marker = object()


@implementer(INameChooser)
@adapter(ILanguageRootFolder)
class LRFNameChooser(NormalizingNameChooser):
    """Special name chooser to fix issue where createContentInContainer is
    used to create a new content into LRF with an id, which exists already
    in the parent folder.

    """
    def chooseName(self, name, object):
        chosen = super(LRFNameChooser, self).chooseName(name, object)
        if chosen in self.context.objectIds():
            old_id = getattr(object, 'id', None)
            object.id = chosen
            chooser = ITranslationIdChooser(object)
            chosen = chooser(self.context, self.context.getId())
            object.id = old_id
        return chosen


@implementer(ILanguageRootFolder, INavigationRoot)
class LanguageRootFolder(Container):
    """Deprecated LanguageRootFolder custom base class"""
deprecated('LanguageRootFolder',
           'LanguageRootFolders should be migrate to DexterityContainers')
开发者ID:AnneGilles,项目名称:plone.app.multilingual,代码行数:30,代码来源:lrf.py


示例14: add_renderer_globals

        context, request, **kwargs)


def add_renderer_globals(event):
    if event.get('renderer_name') != 'json':
        request = event['request']
        api = getattr(request, 'template_api', None)
        if api is None and request is not None:
            api = template_api(event['context'], event['request'])
        event['api'] = api


def is_root(context, request):
    return context is request.root
deprecated('is_root', "'is_root' is deprecated as of Kotti 1.0.0. "
           "Use the 'root_only=True' if you were using this as a "
           "'custom_predicates' predicate.")


class Slots(object):
    def __init__(self, context, request):
        self.context = context
        self.request = request

    def __getattr__(self, name):
        for event_type in slot_events:
            if event_type.name == name:
                break
        else:
            raise AttributeError(name)
        value = []
开发者ID:IonicaBizauKitchen,项目名称:Kotti,代码行数:31,代码来源:util.py


示例15: isinstance

        if isinstance(anchor, unicode):
            anchor = anchor.encode('utf-8')
        anchor = '#' + anchor

    if elements:
        suffix = _join_elements(elements)
    else:
        suffix = ''

    return resource_url + suffix + qs + anchor

model_url = resource_url # b/w compat (forever)

deprecated(
    'model_url',
    'pyramid.url.model_url is deprecated as of Pyramid 1.0.  Use'
    '``pyramid.url.resource_url`` instead (API-compat, simple '
    'rename).')

def static_url(path, request, **kw):
    """
    Generates a fully qualified URL for a static :term:`asset`.
    The asset must live within a location defined via the
    :meth:`pyramid.config.Configurator.add_static_view`
    :term:`configuration declaration` (see :ref:`static_assets_section`).

    .. note:: Calling :meth:`pyramid.Request.static_url` can be used to
              achieve the same result as :func:`pyramid.url.static_url`.

    Example::
开发者ID:cjw296,项目名称:pyramid,代码行数:30,代码来源:url.py


示例16: ITemplateRenderer

        include: ``view`` (the view callable that returned the value),
        ``renderer_name`` (the template name or simple name of the
        renderer), ``context`` (the context object passed to the
        view), and ``request`` (the request object passed to the
        view)."""

class ITemplateRenderer(IRenderer):
    def implementation():
        """ Return the object that the underlying templating system
        uses to render the template; it is typically a callable that
        accepts arbitrary keyword arguments and returns a string or
        unicode object """

deprecated(
    'ITemplateRenderer',
    'As of Pyramid 1.5 the, "pyramid.interfaces.ITemplateRenderer" interface '
    'is scheduled to be removed. It was used by the Mako and Chameleon '
    'renderers which have been split into their own packages.'
    )

class IViewMapper(Interface):
    def __call__(self, object):
        """ Provided with an arbitrary object (a function, class, or
        instance), returns a callable with the call signature ``(context,
        request)``.  The callable returned should itself return a Response
        object.  An IViewMapper is returned by
        :class:`pyramid.interfaces.IViewMapperFactory`."""

class IViewMapperFactory(Interface):
    def __call__(self, **kw):
        """
        Return an object which implements
开发者ID:AvdN,项目名称:pyramid,代码行数:32,代码来源:interfaces.py


示例17: isCanonical

        """

    def isCanonical():
        """
        boolean, is this the original, canonical translation of the content.
        """

    def getCanonicalLanguage():
        """
        Return the language code for the canonical translation of this content.
        """

    def getCanonical():
        """
        Return the original, canonical translation of this content.
        """

    def setLanguage(language):
        """
        Sets the language for the current translation - same as DC
        """

    def Language():
        """
        Returns the language of this translation - same as DC
        """

deprecated("ITranslatable",
           "Please use Products.LinguaPlone.interfaces.ITranslatable instead. "
           "This interface will be removed in Plone 5.0")
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:30,代码来源:Translatable.py


示例18: docopt

    args = docopt(doc)
    # establish config file uri
    config_uri = args['<config_uri>']
    pyramid_env = bootstrap(config_uri)
    # Setup logging to allow log output from command methods
    setup_logging(config_uri)
    try:
        func(args)
    finally:
        pyramid_env['closer']()
    return 0


ViewLink = Link
deprecated(
    'ViewLink',
    "kotti.util.ViewLink has been renamed to Link as of Kotti 1.0.0."
    )


def _to_fieldstorage(fp, filename, mimetype, size, **_kwds):
    """ Build a :class:`cgi.FieldStorage` instance.

    Deform's :class:`FileUploadWidget` returns a dict, but
    :class:`depot.fields.sqlalchemy.UploadedFileField` likes
    :class:`cgi.FieldStorage` objects
    """
    f = cgi.FieldStorage()
    f.file = fp
    f.filename = filename
    f.type = mimetype
    f.length = size
开发者ID:disko,项目名称:Kotti,代码行数:32,代码来源:util.py


示例19: resource_url

def resource_url(resource, request, *elements, **kw):
    """
    This is a backwards compatibility function.  Its result is the same as
    calling::

        request.resource_url(resource, *elements, **kw)

    See :meth:`pyramid.request.Request.resource_url` for more information.
    """
    return request.resource_url(resource, *elements, **kw)

model_url = resource_url # b/w compat (forever)

deprecated(
    'model_url',
    'pyramid.url.model_url is deprecated as of Pyramid 1.0.  Use '
    '``pyramid.url.resource_url`` instead (API-compat, simple '
    'rename) or the ``pyramid.request.Request.resource_url`` method.')

def static_url(path, request, **kw):
    """
    This is a backwards compatibility function.  Its result is the same as
    calling::

        request.static_url(path, **kw)

    See :meth:`pyramid.request.Request.static_url` for more information.
    """
    return request.static_url(path, **kw)

def current_route_url(request, *elements, **kw):
开发者ID:DeanHodgkinson,项目名称:pyramid,代码行数:31,代码来源:url.py


示例20: is_binary

            if ldap_node.parent:
                ldap_node.parent._modified_children.add(ldap_node.name)

    @default
    def is_binary(self, name):
        return name in self.parent.root._binary_attributes

    @default
    def is_multivalued(self, name):
        return name in self.parent.root._multivalued_attributes


# B/C
AttributesBehavior = LDAPAttributesBehavior
deprecated('AttributesBehavior', """
``node.ext.ldap._node.AttributesBehavior`` is deprecated as of node.ext.ldap
1.0 and will be removed in node.ext.ldap 1.1. Use
``node.ext.ldap._node.LDAPAttributesBehavior`` instead.""")


@plumbing(
    LDAPAttributesBehavior,
    AttributesLifecycle)
class LDAPNodeAttributes(NodeAttributes):
    """Attributes for LDAPNode.
    """


@implementer(ILDAPStorage, IInvalidate)
class LDAPStorage(OdictStorage):
    attributes_factory = finalize(LDAPNodeAttributes)
开发者ID:bluedynamics,项目名称:node.ext.ldap,代码行数:31,代码来源:_node.py



注:本文中的zope.deprecation.deprecated函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python __show__.off函数代码示例发布时间:2022-05-26
下一篇:
Python deferredimport.deprecated函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap