Pyramid1.10的新功能

本文解释了 Pyramid 与前代版本相比,1.10版 Pyramid 1.9。它还记录了两个版本之间的向后不兼容以及添加到 Pyramid 1.10,以及软件依赖性更改和显著的文档添加。

备注

这个版本是最后一个计划的支持Python2.7的功能版本。在至少2020-01-01之前,当python 2.7达到使用寿命结束时,错误修复将继续被反向移植。1.x系列Pyramid将审查和接受新的功能和背面端口,但新的开发将集中在2.xPyramid上。

功能添加

废弃

  • 这个 pyramid.interfaces.ISession 接口将移动到需要JSON可序列化对象的 Pyramid 2.0版本。看见 升级会话序列化 有关此更改的详细信息,请参阅。请参阅https://github.com/Pylons/pyramid/pull/3353

  • 这个 pyramid.session.signed_serialize()pyramid.session.signed_deserialize() 函数将在中删除 Pyramid 2.0,连同拆除 pyramid.session.UnencryptedCookieSessionFactoryConfig() 在中被弃用 Pyramid 1.5。请切换到使用 pyramid.session.SignedCookieSessionFactory() ,如果仍在使用这些功能,则复制代码或其他会话实现。参见https://github.com/pylons/pyramid/pull/3353

  • 中的媒体范围已弃用 accept 的参数 pyramid.config.Configurator.add_route() . 使用显式媒体类型列表 add_route 支持多种类型。参见https://github.com/pylons/pyramid/pull/3326

  • 中的媒体范围已弃用 accept 的参数 pyramid.config.Configurator.add_view() . 范围到没有替换 add_view 但经过多次讨论,工作流在面对各种客户端提供的 Accept 标题。参见https://github.com/pylons/pyramid/pull/3326

向后不兼容

  • 远离的 pyramid.config.Configurator.set_request_property 从那以后就被弃用了 Pyramid 1.5。代替使用 pyramid.config.Configurator.add_request_method() 具有 reify=Trueproperty=True . 参见https://github.com/pylons/pyramid/pull/3368

  • 在python 3.4+ repoze.lru 相关性已删除。如果你直接在你的应用程序中使用这个软件包,你应该确保你在你的项目中直接依赖它。参见https://github.com/pylons/pyramid/pull/3140

  • 移除 permission 论证从 pyramid.config.Configurator.add_route() . 这是从中删除的功能留下的参数 Pyramid 1.5,此后无任何影响。参见https://github.com/pylons/pyramid/pull/3299

  • 已将内置会话实现修改为 SameSite='Lax' 饼干。这种影响 pyramid.session.BaseCookieSessionFactory()pyramid.session.SignedCookieSessionFactory()pyramid.session.UnencryptedCookieSessionFactoryConfig() . 参见https://github.com/pylons/pyramid/pull/3300

  • 中定义的变量 [pshell] 设置部分将不再覆盖由 setup 功能。参见https://github.com/pylons/pyramid/pull/3318

  • pyramid.config.Configurator.add_notfound_view() 使用默认重定向类异常 pyramid.httpexceptions.HTTPTemporaryRedirect 而不是上一个 pyramid.httpexceptions.HTTPFound . 参见https://github.com/pylons/pyramid/pull/3328

  • 移除 principal 关键字参数来自 pyramid.security.remember() 从那以后就被弃用了 Pyramid 1.6替换为 userid 参数。参见https://github.com/pylons/pyramid/pull/3369

  • 移除 pyramid.tests 用于包含Pyramid测试套件的子包。这些更改还更改了存储库的格式,以便将代码移动到 src 文件夹。参见https://github.com/pylons/pyramid/pull/3387

文档增强功能

  • 广告支持阅读文档道德广告。请参阅https://github.com/pylons/pyramid/pull/3360和https://docs.read the docs.io/en/latest/advertising/ethical-advertising.html

  • 添加对alembic的支持到Pyramid烹饪者炼金术烹饪者,并更新wiki2教程来解释它是如何工作的。参见https://github.com/pylons/pyramid/pull/3307和https://github.com/pylons/pyramid-cookiecutter-alchemy/pull/7

  • 在setup.py中将sphinx凹凸到大于等于1.7.4以支持 emphasize-lines 在PDF中,为Xeletex支持铺平道路。请参阅https://github.com/pylons/pyramid/pull/3271、https://github.com/pylons/pyramid/issues/667和https://github.com/pylons/pyramid/issues/2572。

  • 在快速教程中添加了额外的测试。参见https://github.com/pylons/pyramid/pull/3375