(機械翻訳) Pyramid 変更履歴

1.9.3(未リリース)

  • `` HTTPClientError``と `` HTTPServerError``例外クラスに適切な `` code``と `` title``属性を設定してください。これにより、誤って520エラーコードが返されることを防ぎます。 https://github.com/Pylons/pyramid/pull/3280を参照してください。

1.9.2(2018-04-23)

1.9.1(2017-07-13)

  • すべてのvenusianデコレータに `` _depth``と `` _category``引数を追加してください。 `` _category``引数は、特定のカテゴリで `` config.scan(...、category = ...) を実行するときに登録されるアクションに影響を与えるために使用できます。独自のデコレータをラップするときは、 `` _depth``引数を使用する必要があります。この変更は、 `` pyramid.view.view_config、 `` pyramid.view.exception_view_config``、 `` pyramid.view.forbidden_​​view_config``、 `` pyramid.view.notfound_view_config``、 `` pyramid.events.subscriber ``と `` pyramid.response.response_adapter``のデコレータです。 https://github.com/Pylons/pyramid/pull/3121およびhttps://github.com/Pylons/pyramid/pull/3123を参照してください。
  • Pyramid.config`の前に `` pyramid.viewderivers``をインポートすることができなかった循環インポートを修正しました。 https://github.com/Pylons/pyramid/pull/3124を参照してください。
  • `` pyramid.config.Configurator``がより多くの場所でコンテキストマネージャとして使用されていることを示すためにドキュメントを改善してください。 https://github.com/Pylons/pyramid/pull/3126を参照してください。

1.9(2017-06-26)

  • 1.9b1からの大きな変更はありません。
  • `` docs.pylonsproject.org``がHTTPSを使うためのドキュメントリンクを更新しました。

1.9b1(2017-06-19)

  • 未知の述部が提供されているときに、情報メッセージを追加してください。新しいメッセージは、既知の述語のリストに基づいて選択肢を提案します。 https://github.com/Pylons/pyramid/pull/3054を参照してください。
  • チュートリアルのcookiecutters、足場、および結果のソースファイルにJavaScriptの整合性属性を追加しました。 https://github.com/Pylons/pyramid/issues/2548を参照してください。
  • cookiecuttersを更新するためにRELEASING.txtを更新してください。ショートカットを使用するようにcookiecutterのURLを変更してください。 https://github.com/Pylons/pyramid/issues/3042を参照してください。
  • `` request.invoke_exception_view``から呼び出されたときに、ビューの実行中に正しいスレッドコードがプッシュされていることを確認してください。 https://github.com/Pylons/pyramid/pull/3060を参照してください。
  • `` pyramid.security.ALL_PERMISSIONS``が `` __iter__``の実装で有効なイテレータを返さなかったバグを修正しました。 https://github.com/Pylons/pyramid/pull/3074を参照してください。
  • 許可の結果を適切なクラス階層に正規化します。 `` pyramid.security.ACLAllowed``は `` pyramid.security.Allowed``のサブクラスであり、 `` pyramid.security.ACLDenied``は `` pyramid.security.Denied``のサブクラスです。 https://github.com/Pylons/pyramid/pull/3084を参照してください。
  • `` pyramid.encode.urlencode``に `` quote_via``引数を追加してstdlibのバージョンに従い、カスタム引用関数を有効にします。 https://github.com/Pylons/pyramid/pull/3088を参照してください。
  • `` request.resource_url``と `` query = None``と `` anchor = None``に _query = None`と _anchor = None`をサポートしています。これまでは、URLの中に ```# 'がそれぞれ付いていました。生成されたURLから不要な部分が削除されました。 https://github.com/Pylons/pyramid/pull/3034を参照してください。
  • `` IExecutionPolicy``で使用される `` IRouter`` APIを、リクエストthreadlocalsのプッシュ/ポップを強制的に行うために改訂します。 `` IRouter.make_request(environ) `` APIはコンテキストマネージャーとして使われる `` IRouter.request_context(environ) ``に置き換えられました。 https://github.com/Pylons/pyramid/pull/3086を参照してください。

1.9a2(2017-05-09)

後方の非互換性

  • 応答がEXCVIEWトゥイーンによって生成された場合にのみ、 `` request.exception``と `` request.exc_info``がセットされます。これは、応答がパイプラインのどこかで生成され、元の例外とは直接関係しない混乱を避けるためです。アップストリームの誰かが例外に対する応答を捕捉してレンダリングしたい場合、応答を生成するときに押しつぶされた例外を示すために、 `` request.exception``と `` request.exc_info``をそれ自身で設定するべきです。

    同様の挙動が、 `` request.invoke_exception_view``で発生します。例外のプロパティは、メソッドによって応答が正常に生成された場合に例外を反映するように設定されています。

    これは非常に小さな不一致です。現在、ほとんどのtweensは、発生した例外を優先し、 `` request.exception``を無視します。この変更では、レスポンスとその押しつぶされた例外との関係をより明確にしようとすることによって、その簿記が改善され、明確化されます。 https://github.com/Pylons/pyramid/pull/3029およびhttps://github.com/Pylons/pyramid/pull/3031を参照してください。

1.9a1(2017-05-01)

主な特長

  • `` pserve``や `` pshell``や `` pyramid.paster.bootstrap``などのすべての `` p * ``コマンドラインスクリプトで使用されているファイル形式は、新しい`石膏への依存<https://docs.pylonsproject.org/projects/plaster/en/latest/> `_。

    今のところ、Pyramidは `plaster_pastedeployに依存してPasteDeploy INIフォーマットの統合サポートを提供しています<https://github.com/Pylons/plaster_pastedeploy> `バインディングライブラリ。これは将来変更される可能性があります。

    https://github.com/Pylons/pyramid/pull/2985を参照してください。

  • 要求パイプラインに実行ポリシーフックを追加しました。実行ポリシーには、要求オブジェクトがパイプラインの残りの部分に入る前に、その要求オブジェクトの作成と実行を制御する機能があります。これは、単一の要求環境に対して、ポリシーが複数の要求オブジェクトを作成する可能性があることを意味します。

    この機能を使うための最初のライブラリは `pyramid_retry <https://docs.pylonsproject.org/projects/pyramid-retry/en/latest/> `_。

    https://github.com/Pylons/pyramid/pull/2964を参照してください。

  • CSRFのサポートは、 `` pyramid.csrf``モジュールの中で、セッションから独立したAPIにリファクタリングされました。これは、プラグイン可能な `` pyramid.interfaces.ICSRFStoragePolicy``をサポートしています。これは、CSRFトークンを生成し、検証する独自のメカニズムを定義するために使用できます。デフォルトでは、Pyramidは互換性を保つために `` request.session.get_csrf_token``と `` request.session.new_csrf_token`` APIをフードの下で使用する `` pyramid.csrf.LegacySessionCSRFStoragePolicy``を引き続き使用します。 CSRFトークンをセッションとスタンドアロンのクッキーにそれぞれ格納する `` pyramid.csrf.SessionCSRFStoragePolicy``と `` pyramid.csrf.CookieCSRFStoragePolicy``の2つの新しいポリシーも出荷されています。ストレージポリシーは、新しい `` pyramid.config.Configurator.set_csrf_storage_policy``設定ディレクティブを使用して変更できます。

    ストレージポリシーが変更された場合、CSRTトークンは、新しいpyramid.csrf.get_csrf_token``、 `` pyramid.csrf.new_csrf_token``、および `` pyramid.csrf.check_csrf_token`` APIを使用して作業を続行する必要があります。また、 `` pyramid.csrf.get_csrf_token``関数はテンプレートに注入され、UIコードに便利に使用されます。

    https://github.com/Pylons/pyramid/pull/2854およびhttps://github.com/Pylons/pyramid/pull/3019を参照してください。

マイナー機能

  • 設定ファイルの `` pserve``セクションで `` open_url``設定をサポートしてください。このurlは `` pserve - browser &#39;`が呼び出されたときにウェブブラウザを開くために使われます。この設定が利用できない場合、 `` pserve``スクリプトはサーバが使用しているポートを `` server: <server_name> configファイルの ``セクションには書かれていますが、サーバがこのフォーマットで実行されているため、失敗する可能性はありません。 https://github.com/Pylons/pyramid/pull/2984を参照してください。
  • `` pyramid.config.Configurator``は、( `` config.begin() ``や `` config.end() ``に似た)スレッドマネージャを自動的にプッシュ/ポップするコンテキストマネージャとして使用できるようになりました。また、 `` config.commit() ``も自動的に実行されるため、アプリの最上位レベルでのみ使用することをお勧めします。 https://github.com/Pylons/pyramid/pull/2874を参照してください。
  • threadlocalsは `` config.include``で呼び出された関数の中で利用できるようになりました。つまり、threadlocalsに依存できない唯一のコンフィギュレーションタイムコードは、メイン内部の非アクションから実行されるコードです。これは、 `` config.begin() ``と `` config.end() ``を適切に呼び出すか、コンフィギュレータの新しいコンテキストマネージャ機能を使用することで軽減できます。 https://github.com/Pylons/pyramid/pull/2989を参照してください。

バグの修正

  • HTTPExceptionは、例外に追加の詳細を渡すために使用されるディテールkwargを受け入れます。 __str__メソッドが有効な限り、オブジェクトを渡すことができます。 https://github.com/Pylons/pyramid/pull/2951を参照してください。
  • コンフィグレータが破棄された後でも、レジストリが `` Configurator``インスタンスを生きたままにするメモリリークの原因となる参照サイクルを修正しました。レジストリがクロージャ内に格納されている `` global_registries``オブジェクトに対して、もう一つの修正が追加されました。 https://github.com/Pylons/pyramid/pull/2967を参照してください。
  • 指定された `` argv``の代わりに `` sys.argv``が常にサブプロセスで使われる `` --reload``オプションで `` pyramid.scripts.pserve.main``を直接呼び出すバグを修正しました。 。 https://github.com/Pylons/pyramid/pull/2962を参照してください。

廃止

  • Pyramidは現在、 `` plaster_pastedeploy``に依存して、INIファイルの統合サポートを維持して ``石膏 &#39;&#39;への移行を単純化しています。 `` plaster_pastedeploy``へのこの依存性は、Pyramidの非推奨ポリシーの対象となり、将来削除される可能性があります。アプリケーションは、ニーズを満たすために適切な石膏製本に依存する必要があります。

  • セッションからCSRFトークンを取得することは、 `` pyramid.csrf``モジュールの同等のメソッドを使うことを前提に廃止されました。デフォルトの `` pyramid.csrf.LegacySessionCSRFStoragePolicy``を使用する場合を除いて、 `` ISession``インタフェースでCSRFメソッド( `` ISession.get_csrf_token``と `` Session_new_csrf_token``)は不要になりました。

    また、 `` pyramid.session.check_csrf_token``は `` pyramid.csrf.check_csrf_token``にあります。

    https://github.com/Pylons/pyramid/pull/2854およびhttps://github.com/Pylons/pyramid/pull/3019を参照してください。

ドキュメントの変更点

1.8(2017-01-21)

  • 1.8b1から大きな変更はありません。

1.8b1(2017-01-17)

特徴

  • `` config.add_translation_dirs``に `` override``オプションを追加して、後の呼び出しで以前の呼び出しよりも高い優先度で翻訳ディレクトリを配置できるようにしました。 https://github.com/Pylons/pyramid/pull/2902を参照してください。

ドキュメントの変更点

  • レジストリのドキュメントを改善して、コンポーネントレジストリや辞書としての用途について話し合うhttps://github.com/Pylons/pyramid/pull/2893を参照してください。
  • クイックツアー、クイックチュートリアル、およびその他のほとんどのドキュメントは、pcreateや足場の代わりにcookiecuttersを使用するように更新されました。 https://github.com/Pylons/pyramid/pull/2888およびhttps://github.com/Pylons/pyramid/pull/2889を参照してください。
  • py2とpy3の依存関係がなくても動作するようにwiki2のunittestを修正しました。 https://github.com/Pylons/pyramid/pull/2899を参照してください。
  • インストーラの最新のPython 3の改善を追跡するために、Windowsのドキュメントを更新してください。 https://github.com/Pylons/pyramid/pull/2900を参照してください。
  • cookiecuttersとApache 2.4+を使うための `` mod_wsgi``チュートリアルを更新しました。 https://github.com/Pylons/pyramid/pull/2901を参照してください。

1.8a1(2016-12-25)

後方の非互換性

  • Pyramid 1.3で廃止された `` IContextURL``インターフェースのサポートが削除されました。 https://github.com/Pylons/pyramid/pull/2822を参照してください。

  • ピラミッドの非推奨期間(1.6 - &gt; 1.8)の後、pserveのデーモンサポートは削除されました。これには、デーモンコマンド(start、stop、restart、status)と `` --daemon``、 `` --pid-file``、 `` -log-file``、 `` --monitor-restart``、 `` --status``、 `` --user``、 `` --group``、 `` --stop-daemon``

    サーバをデーモンとして実行するには、pserveではなくプロセスマネージャを使用する必要があります。

    https://github.com/Pylons/pyramid/pull/2615を参照してください。

  • `` pcreate``はデフォルトで対話型になりました。異なる内容のファイルがすでに存在するかどうかを確認するメッセージが表示されます。これまでは、 `` --interactive``や `` --overwrite``を指定しない限り、類似したファイルがあった場合、それらを静かにスキップしていました。 https://github.com/Pylons/pyramid/pull/2775を参照してください。

  • `` pyramid.static.static_view``から文書化されていない引数 `` cachebust_match``を削除しました。この議論は、Pyramid 1.6で誤って出荷されました。 https://github.com/Pylons/pyramid/pull/2681を参照してください。

  • 静的ビューを変更して、 `` Content-Encoding``レスポンスヘッダをPythonの `` mimetypes``モジュールを使って推測されるエンコーディングに設定しないようにします。これは、クライアントがgzipファイルをダウンロードするときにその内容をデコードする原因となっていました。クライアントは、既にデコードされたディスク上の `` foo.txt.gz``ファイルで終わるので、実際は `` foo.txt``でなければなりません。また、 `` Content-Encoding``は、クライアント自身が `` Accept-Encoding``リクエストヘッダを使ってエンコーディングをサポートしている場合にのみ使われるべきです。 https://github.com/Pylons/pyramid/pull/2810を参照してください。

  • 設定は、設定オブジェクトの属性としてアクセスできなくなりました( `` request.registry.settings.foo``など)。これはPyramid 1.2では推奨されていませんでした。 https://github.com/Pylons/pyramid/pull/2823を参照してください。

特徴

  • Python 3.6との互換性。 https://github.com/Pylons/pyramid/issues/2835

  • `` pcreate``は `` --package-name``について学びました。プロジェクト名とは異なるパッケージ名で既存のフォルダに新しいプロジェクトを作成することができます。 https://github.com/Pylons/pyramid/pull/2783を参照してください。

  • `` DefaultAuthAuthenticationPolicy``の `` _get_credentials``プライベートメソッドは、 `` pyramid.authentication``モジュールのスタンドアロン関数 `` extract_http_basic_credentials``に展開されています。この関数は `` request``オブジェクトからHTTP基本認証情報を抽出し、名前付きタプルとして返します。 https://github.com/Pylons/pyramid/pull/2662を参照してください。

  • Pyramid 1.4は、復元されたコンフィギュレータの機能を静かに削除しました。行動弁別者が異なる行動秩序にぶつかり合うことも可能です。 https://github.com/Pylons/pyramid/pull/2757を参照してください。

  • `` pyramid.paster.bootstrap``とその兄弟の `` pyramid.scripting.prepare``をコンテクストマネージャーとして使うことができるようになりました。自動的に `` close``を呼び出し、メモリリークを防ぐためにスレッドロックをスタックから外しました。 https://github.com/Pylons/pyramid/pull/2760を参照してください。

  • `` pyramid.config.Configurator.add_exception_view``と `` pyramid.view.exception_view_config``デコレータを追加しました。これらのメソッドを使うか、新しい `` exception_only = True``オプションを使って、 `` add_view``を使って例外を扱うときにのみマッチするビューを追加することが可能になりました。以前は、例外クラスから継承されたトラバーサルコンテキストに対して例外ビューも登録されていたため、例外のみの最適化はできませんでした。 https://github.com/Pylons/pyramid/pull/2660を参照してください。

  • `` pyramid.interfaces.IViewDeriverInfo``に `` exception_only``ブーリアンを追加しました。これは、ビューデリバーが例外を処理するだけのビューをラッピングしているかどうかを判断するのに使うことができます。これは、ビューが例外を処理しているかどうかを判断するために `` request.exception``のために要求時間チェックを実行する必要がなくなり、パイプラインを設定時に最適化できることを意味します。 https://github.com/Pylons/pyramid/pull/2660を参照してください。

  • `` pserve``は、サーバやアプリケーションがピラミッドの残りの部分をインポートする前にできるだけ早くそれを行うと仮定して、プロセスをmonkeypatchする必要がある `` gevent``や他のワーカーで動作するはずです。 https://github.com/Pylons/pyramid/pull/2797を参照してください。

  • Pyramidは `` pyramid.config.Configurator(settings =) ``に渡された設定オブジェクトをコピーしません。元の `` dict``が保持されます。 https://github.com/Pylons/pyramid/pull/2823を参照してください。

  • csrf trusted origininsの設定は、空白で区切られたドメインのリストになりました。以前は、Pythonのリストだけが許可されていました。また、他の設定と同様の `` PYRAMID_CSRF_TRUSTED_ORIGINS``環境変数を使って設定することもできます。 https://github.com/Pylons/pyramid/pull/2823を参照してください。

  • `` pserve --reload``は `` hupper <http://docs.pylonsproject.org/projects/hupper/en/latest/> `ライブラリを使用してファイルの変更を監視します。これには多くの改善が伴います:

    • `watchdog <http://pythonhosted.org/watchdog/> `_パッケージがインストールされていれば、cpuとディスク集約的なポーリングの代わりにinotifyを使って監視が行われます。
    • モニタは、コードの前にクラッシュしたり起動したりすることのない別のプロセスになりました。
    • ファイルが保存されるまで、クラッシュ後にモニターはプロセスを再始動しません。
    • モニターはウィンドウ上で動作します。
    • `` hupper.get_reloader()。trigger_reload() ``を使ってピラミッドビューやその他のコードから手動でリロードをトリガできるようになりました。ちょっとしたもの。
    • 監視プロセスに対して `` SIGHUP``を発行することによって、再ロードをトリガーすることができます。

    https://github.com/Pylons/pyramid/pull/2805を参照してください。

  • 新しい `` [pserve] ``セクションは、カスタムファイルパスを監視する `` pserve --reload``を設定できる `` watch_files``キーで設定ファイルでサポートされています。 https://github.com/Pylons/pyramid/pull/2827を参照してください。

  • `` pyramid.httpexceptions.HTTPException`のサブクラスからストリーミング応答を作成できるようにします。以前は、ボディのテスト中に応答が展開され、応答をストリーミングできなくなりました。 https://github.com/Pylons/pyramid/pull/2863を参照してください。

  • ウェイトレスの新しい &quot;listen&quot;ディレクティブを使用して、IPv6をサポートするためのスターター、錬金術、zodbの足場を更新します。 https://github.com/Pylons/pyramid/pull/2853を参照してください。

  • すべてのp *スクリプトは、optparseではなくargparseを使用するようになりました。これは `` --help``の出力を改善するだけでなく、それらのオプションのより良いドキュメントを可能にします。 https://github.com/Pylons/pyramid/pull/2864を参照してください。

  • `` config.action`によって登録された遅延コンフィグレーションアクションは、アセットのオーバーライドなどのスレッドローカル状態に依存するようになり、アクションの実行時にアクティブになります。 https://github.com/Pylons/pyramid/pull/2873を参照してください。

  • `` config.add_translation_dirs``に渡されるディレクトリのアセット仕様は、フォルダ名を含むアセット仕様全体をオーバーライドできるようになりました。以前はパッケージ名のみがサポートされていたため、フォルダの名前は常に同じにする必要がありました。 https://github.com/Pylons/pyramid/pull/2873を参照してください。

  • `` config.begin() ``は、レジストリが同じである限り、現在のスレッドローカルリクエストを伝播します。例えば:

    request = Request.blank(...)
    config.begin(request)  # pushes a request
    config.begin()         # propagates the previous request through unchanged
    assert get_current_request() is request
    

    https://github.com/Pylons/pyramid/pull/2873を参照してください。

  • `` config.set_default_csrf_options``に新しい `` callback``オプションを追加しました。これは、リクエストごとにCSRFチェックを有効にして、混在認証方法を許可する必要があるかどうかを判断するために使用できます。 Cookieベースの方法だけでは、一般的にCSRFチェックが必要です。 https://github.com/Pylons/pyramid/pull/2778を参照してください。

バグの修正

  • `` proutes``のバグを修正し、クラスと `` attr``が関わっているときに正しいビューを表示するようになりました。参照:https://github.com/Pylons/pyramid/pull/2687
  • `` proutes``スクリプトの `` format``設定で `` re.split``を使うとき、Python 3.5で `` FutureWarning``を修正してください。 https://github.com/Pylons/pyramid/pull/2714を参照してください。
  • `` AuthTktAuthenticationPolicy``の `` userid``として任意のオブジェクトを使用するときにWebObが出力する `` RuntimeWarning``を修正しました。これは現在、ポリシーによって捕捉され、オブジェクトは暗号の警告を回避するためにbase64文字列としてシリアル化されます。以降のリクエストでは、ユーザーIDは文字列として読み込まれるため、より有用な警告が表示され、代わりにプリミティブ型を使用するように促します。 https://github.com/Pylons/pyramid/pull/2715を参照してください。
  • Pyramid 1.6では、アクションが別のアクションを呼び出す機能が導入されました。 「config.add_view」がPyramid 1.7で導入されたカスタムビューデリバーとやりとりするというバグがありました。これは、ビューデリバーとビュー述語が以前のオーダーで作成されるまでビューの弁別子が計算できないためです。別のアクションからアクションを呼び出すと、パイプラインのアンロールがトリガーされ、ディスティメーターが準備される前にそれらが計算されます。新しい動作はアクションの「順序付け」を尊重し、以前の命令からの依存アクションが実行されるまで弁別器が計算されないようにします。 https://github.com/Pylons/pyramid/pull/2757を参照してください。
  • 関連するメッセージファイル内に異なる複数の関数が定義されていても、デフォルトのドメインが常にドイツ語の複数形を使用するi18nのバグを修正しました。 https://github.com/Pylons/pyramid/pull/2859を参照してください。
  • `` config.override_asset``メソッドは `` pyramid.config.PHASE1_CONFIG`の間に `` config.add_translation_dirs``の呼び出しの前に実行するように命令されるようになりました。 https://github.com/Pylons/pyramid/pull/2873を参照してください。

廃止

ドキュメントの変更点

1.7(2016-05-19)

  • bcryptが常にバイト文字列を期待しているwiki2チュートリアルのバグを修正しました。 https://github.com/Pylons/pyramid/pull/2576を参照してください。
  • ウィンドウ検出コードを単純化し、重複したデータを削除します。 https://github.com/Pylons/pyramid/pull/2585およびhttps://github.com/Pylons/pyramid/pull/2586を参照してください。

1.7b4(2016-05-12)

  • 例外を処理するための例外ビューが見つからない場合、元の例外を再発生させるように例外ビューのtweenを修正しました。これにより、未処理のまま残った例外を処理するために、チェーンの上にトゥイーンをさらに上げることができます。以前は、述部がビューの例外処理に失敗した場合、それらは `` PredicateMismatch``例外に変換されていました。 https://github.com/Pylons/pyramid/pull/2567を参照してください。
  • `` pyramid.interfaces.IRequestFactory``インターフェースを公開して、 `` pyramid.interfaces.IResponseFactory``インターフェースを反映させました。

1.7b3(2016-05-10)

  • ビューが一致しない場合、 `` request.invoke_exception_view``を `` HTTPNotFound``例外を発生させるように修正しました。以前は `` None``が返されます。ビューが一致しなかった場合には `` PredicateMismatch``が返されます。ビューが&quot;ほとんど&quot;一致した場合(コンテキストに一致するビューが見つかった場合) https://github.com/Pylons/pyramid/pull/2564を参照してください。
  • py.testの設定とカバレッジのデフォルトを3つすべてのスカフォールドに追加し、それに従ってドキュメントを更新します。 https://github.com/Pylons/pyramid/pull/2550を参照してください。
  • Sphinxの `` Makefile``に `` linkcheck``を追加してください。ドキュメントの壊れたリンクを調べるには、 `` make linkcheck SPHINXBUILD = $ VENV / bin / sphinx-build``コマンドを使います。また、数十の壊れた外部リンクを削除して修正しました。
  • 内部ランナーを足場テストのために修正して、pipとpy.testで動作するようにします。 https://github.com/Pylons/pyramid/pull/2565を参照してください。

1.7b2(2016-05-01)

  • developmental.iniのpyramid_tmを錬金術足場に含めるのを削除しました。https://github.com/Pylons/pyramid/issues/2538を参照してください。
  • `` config.set_default_permission``で設定されたデフォルトの権限は、もはや例外ビューでは強制されません。これはデフォルトの例外ビュー( `` config.add_notfound_view``と `` config.add_forbidden_​​view``)を使ってしばらくの間そうなっていましたが、他の例外ビューでは開発者は `` permission = NO_PERMISSION_REQUIRED``物事がうまくいかなかった時には驚いた。 `` permission``引数を手動で `` config.add_view``に設定することによって、例外ビューのパーミッションチェックを強制することも可能です。この動作は、1.7シリーズで追加された新しいCSRF機能と一致しています。 https://github.com/Pylons/pyramid/pull/2534を参照してください。

1.7b1(2016-04-25)

  • このリリースでは、1.7のベータ期間が発表されます。
  • 1.7シリーズから削除された錬金術足場にいくつかのファイルが含まれていた問題を修正しました。 https://github.com/Pylons/pyramid/issues/2525を参照してください。

1.7a2(2016-04-19)

特徴

  • 例外ビューでは、自動CSRFチェックはデフォルトで無効になっています。彼らは、ビューに適切な `require_csrf`オプションを設定することによって、再び有効にすることができます。 https://github.com/Pylons/pyramid/pull/2517を参照してください。
  • 自動CSRF APIは、オプションを設定するためのconfigディレクティブを使用するように修正されました。 `` pyramid.require_default_csrf``の設定はサポートされなくなりました。代わりに、新しい `` config.set_default_csrf_options``ディレクティブが導入されました。これにより開発者は `` require_csrf``のデフォルト値を指定し、CSRFトークン、ヘッダ、安全なリクエストメソッドを変更することができます。 `` pyramid.csrf_trusted_origins``の設定は引き続きサポートされています。 https://github.com/Pylons/pyramid/pull/2518を参照してください。

バグの修正

1.7a1(2016-04-16)

後方の非互換性

  • ピラミッドの非推奨期間(1.4 - &gt; 1.6)の後、AuthTktAuthenticationPolicyのデフォルトハッシュアルゴリズムはmd5からsha512に変更されています。認証ポリシーを使用しており、md5を引き続き使用する必要がある場合は、明示的にhashalgを &#39;md5&#39;に設定してください。

    この変更は、既存の認証チケット(および関連するCookie)が有効でなくなり、ユーザーはもうログインしなくなり、アカウントに再度ログインする必要があることを意味します。

    https://github.com/Pylons/pyramid/pull/2496を参照してください。

  • `` check_csrf_token``関数は、リクエストのクエリ文字列中のcsrfトークンをもはや検証しません。ヘッダーとリクエストボディのみがサポートされています。 https://github.com/Pylons/pyramid/pull/2500を参照してください。

特徴

  • 新しい設定、 `` pyramid.require_default_csrf``を追加しました。これは、アプリケーションのPOST要求ごとにCSRFチェックをグローバルに有効にするために使用されます。これは、Pyramid上に構築されたウェブサイトのための良いデフォルトと見なされるべきです。これらのビューに対して `` require_csrf = False``を設定することで、ビュー単位でCSRFチェックをオプトアウトすることができます。 https://github.com/Pylons/pyramid/pull/2413を参照してください。
  • `` require_csrf``ビューオプションを追加しました。これは、RFC2616で定義されている安全でないメソッドを使って、すべての要求に対してCSRFチェックを強制します。 CSRFチェックが失敗した場合、 `` BadCSRFToken``例外が発生し、例外ビュー(デフォルトの応答は `` 400 Bad Request``です)によって捕捉されます。このオプションは、非推奨の `` check_csrf``ビュー述語の代わりに使用されるべきです。この述語は通常、キャッチ可能な例外の代わりに予期しない `` 404 Not Found``応答をクライアントに送ります。 https://github.com/Pylons/pyramid/pull/2413およびhttps://github.com/Pylons/pyramid/pull/2500を参照してください。
  • 要求の起点/参照元をチェックし、現在の `` request.domain``と一致することを確認する追加のCSRF検証を追加しました。この特定のチェックは、HTTPS経由でサイトにアクセスする場合にのみ有効です。そうしないと、ブラウザが常に必要な情報を送信するとは限りません。この追加のCSRF検証に失敗した場合、 `` BadCSRFOrigin``例外が発生し、例外ビュー(デフォルトの応答は `` 400 Bad Request``です)によって捕捉される可能性があります。 `` pyramid.csrf_trusted_origins``を許可するドメイン名のリスト(非標準ポートの場合はポート付き)に設定することにより、追加の許可されたオリジンを設定することができます。サブドメインはドメイン名の前に `` .``が付いていなければ許されません。 https://github.com/Pylons/pyramid/pull/2501を参照してください。
  • リクエストのドメインに対してオリジンまたはリファラーヘッダを検証するための新しい `` pyramid.session.check_csrf_origin`` APIを追加しました。 https://github.com/Pylons/pyramid/pull/2501を参照してください。
  • Pyramid HTTPExceptionsはクライアントのAcceptヘッダーに最も適したものを考慮に入れ、要求されたものに応じてtext / html、application / jsonまたはtext / plainを返します。 * / *のデフォルトはtext / htmlですが、application / jsonが明示的に記述されている場合は、有効なJSON応答を受け取ります。 https://github.com/Pylons/pyramid/pull/2489を参照してください。
  • 新しいイベントとインタフェース(BeforeTraversal)が導入されました。このインタフェースは、ルータ内でトラバーサルが開始される前にリスナーに通知します。 https://github.com/Pylons/pyramid/pull/2469およびhttps://github.com/Pylons/pyramid/pull/1876を参照してください。
  • ピラミッドに新しい&quot;ビューデリバー&quot;の概念を追加すると、フレームワークの作成者はピラミッドビューの標準パイプラインに要素を挿入し、アプリケーション内のすべてのビューに影響を与えることができます。これはデコレータに似ていますが、 `` config.add_view``に渡されるオプションにアクセスでき、ビューからの生のレスポンスやセキュリティチェックの前にパイプラインの他のステージに影響を与える可能性があります。 https://github.com/Pylons/pyramid/pull/2021を参照してください。
  • 要求パラメタ述語のキーに先行する `` = ``を許可します。たとえば、 &#39;= abc = 1&#39;は `` request.params [&#39;= abc&#39;] == &#39;1&#39;``と同等です。 https://github.com/Pylons/pyramid/pull/1370を参照してください。
  • 例外ビューを呼び出して応答を返すために使用できる新しい `` request.invoke_exception_view(...) ``メソッド。これは、あなたがリクエストをより詳細に制御する必要があるかもしれないexcview tweenのコンテキスト外で例外ビューをレンダリングする場合に便利です。 https://github.com/Pylons/pyramid/pull/2393を参照してください。
  • .iniファイルのロギングセクションに %(LOGGING_LOGGER_ROOT_LEVEL)s``のような変数の置き換えを許可し、 `` pserve``コマンドラインからこれらの変数を設定します - 例えば `` pserve development.ini LOGGING_LOGGER_ROOT_LEVEL = DEBUG https://github.com/Pylons/pyramid/pull/2399を参照してください。

ドキュメントの変更点

  • ドキュメントの完全なオーバーホール:

    • easy_installの代わりにpipを使用してください。
    • Python 3.4以上を好むことで、Pythonとその必要なパッケージングツールのインストールを簡素化することで、意見を表明してください。
    • virtualenvの代わりに、venvをツール用に、仮想環境を作成用に使用してください。
    • noseとカバレッジの代わりにpy.testとpytest-covを使用してください。
    • チュートリアルとそのsrcファイルだけでなく、足場への更なるアップデート。

    https://github.com/Pylons/pyramid/pull/2468を参照してください。

  • `` alchemy`足場とWiki2 SQLAlchemy + URLDispatchチュートリアルを完全に見直して、PyramidでSQLAlchemyを使用する際のより現代的な機能を紹介し、新しいプロジェクトの出発点を提供します。 https://github.com/Pylons/pyramid/pull/2024を参照してください。

バグの修正

  • 使用するセクションを選択するときに、アプリケーション名の代わりに `` --server-name``を使うように `` pserve - browser &#39;&#39;を修正しました。これは、 `` [app:main] ``と `` [server:main] ``のように、同じ名前のサーバーセクションとアプリケーションセクションを持っていた人たちのためだけに働いていました。 https://github.com/Pylons/pyramid/pull/2292を参照してください。

廃止

1.6(2016-01-03)

廃止

  • `` --user``と `` --group``オプションを非推奨にして、 `` pserve``デーモン/プロセス管理機能の削除を続けてください。 https://github.com/Pylons/pyramid/pull/2190を参照してください。

1.6b3(2015-12-17)

後方の非互換性

  • `` config.add_static_view``から `` cachebust``オプションを削除してください。キャッシュバスターを静的資産に付加する新しい方法については、 `` config.add_cache_buster``を参照してください。 https://github.com/Pylons/pyramid/pull/2186を参照してください。

  • `` pyramid.interfaces.ICacheBuster`` APIを `` match``メソッドと `` pregenerate``メソッドを持つオブジェクトではなく単純な呼び出し可能オブジェクトに変更してください。キャッシュ・バスターは現在、世代だけに焦点を当てています。マッチングは削除されました。

    これは `` pyramid.static.QueryStringCacheBuster``と `` pyramid.static.ManifestCacheBuster``の使用に影響します。

    https://github.com/Pylons/pyramid/pull/2186を参照してください。

特徴

  • 静的アセットにキャッシュバスターを追加するための新しい `` config.add_cache_buster`` APIを追加してください。 https://github.com/Pylons/pyramid/pull/2186を参照してください。

バグの修正

  • `` IAssetDescriptor.abspath``は常に絶対パスを返すようにしてください。プロセスのCWDに応じて、相対パスが返されるケースがありました。 https://github.com/Pylons/pyramid/issues/2188を参照してください。

1.6b2(2015-10-15)

特徴

  • ファイルシステムのパスを必要とするのではなく、 `` pyramid.static.ManifestCacheBuster``にアセット仕様を与えることができます。

1.6b1(2015-10-15)

後方の非互換性

  • IPythonとBPythonのサポートはコアのpshellから削除されました。 Pyramid 1.6以降で引き続き使用するには、バインディングパッケージを明示的にインストールする必要があります。

    $ pip install pyramid_ipython
    
    or
    
    $ pip install pyramid_bpython
    
  • `` PathSegmentCacheBuster``、 `` PathSegmentMd5C​​acheBuster``、および `` QueryStringMd5CacheBuster``を含む1.6a1で導入されたデフォルトのキャッシュバスターを削除してください。 https://github.com/Pylons/pyramid/pull/2116を参照してください。

特徴

  • `` pshell``用の追加のシェルをエントリーポイントとして登録できるようになりました。 https://github.com/Pylons/pyramid/pull/1891およびhttps://github.com/Pylons/pyramid/pull/2012を参照してください。
  • 可能であれば、 `` pshell``に注入された変数はデフォルトの `` str(obj) ``ではなくdocstringで表示されます。 https://github.com/Pylons/pyramid/pull/1929を参照してください。
  • 外部資産パイプラインで使用するための新しい `` pyramid.static.ManifestCacheBuster``と、物語の一般的な使用例を追加してください。 https://github.com/Pylons/pyramid/pull/2116を参照してください。
  • 構文エラーで `` pserve --reload``がクラッシュしないように修正しました! https://github.com/Pylons/pyramid/pull/2125を参照してください。
  • 時刻関連パラメータ `` timeout``、 `` reissue_time``、 `` max_age``に対して、ユーザが未解析の文字列を `` pyramid.session.CookieSession``と `` pyramid.authentication.AuthTktCookieHelper``に渡すときの問題を修正しました。整数値が必要です。 https://github.com/Pylons/pyramid/pull/2050を参照してください。

バグの修正

  • `` pyramid.httpexceptions.HTTPException``は、WebOb 1.5の変更に適合するよう `` None None``ではなく `` Unknown Error``をデフォルトにしました。 https://github.com/Pylons/pyramid/pull/1865を参照してください。
  • `` pshell``はINIファイルの `` [pshell] ``セクションに変数の大文字を保存します。これにより、シェルへのクラスの公開がより簡単になります。 https://github.com/Pylons/pyramid/pull/1883を参照してください。
  • 恐ろしい方法で失敗する `` pserve --monitor-restart --daemon``の使用を修正しました。 https://github.com/Pylons/pyramid/pull/2118を参照してください。
  • 明示的に `` pserve --reload - daemon``が使用されないようにしてください。それは決してサポートされていませんが、奇妙な方法で動作し、失敗するでしょう。 https://github.com/Pylons/pyramid/pull/2119を参照してください。
  • 実行するpserveスクリプトが見つからなかったためプロセスがforkできなかった `` pserve --reload``を実行しているときに、Windows上の問題を修正しました。 https://github.com/Pylons/pyramid/pull/2138を参照してください。

廃止

  • CircusやSupervisorのようなPythonベースのソリューションだけでなく、SystemdやUpstartなどの実際のプロセスマネージャを使用するユーザのために、 `` pserve --monitor-restart``を非難してください。 https://github.com/Pylons/pyramid/pull/2120を参照してください。

1.6a2(2015-06-30)

バグの修正

  • `` pyramid.httpexceptions.exception_response``が `` 400``と `` 500``ステータスコードの適切な &quot;concrete&quot;クラスを返すことを確認してください。 https://github.com/Pylons/pyramid/issues/1832を参照してください。
  • `` pyramid.view.render_view_to_response``が直接的または間接的に呼び出されたときに1.6a1で導入された無限再帰バグを修正しました。 https://github.com/Pylons/pyramid/issues/1643を参照してください。
  • JSONPレンダラを修正するには、返されたコンテンツの先頭にコメントを付けます。これにより、Flashからの攻撃を軽減する必要があります(CVE-2014-4671を参照)。 https://github.com/Pylons/pyramid/pull/1649を参照してください。
  • JSONPコールバックにピリオドと大括弧( `` [] ``)を付けてください。元の修正は過度に制限的であり、Angularを破った。 https://github.com/Pylons/pyramid/pull/1649を参照してください。

1.6a1(2015-04-15)

特徴

  • 現在存在するプロジェクト名、または現在の環境でインポート可能なプロジェクト名の引数を指定して起動すると、確認メッセージが表示されます。 https://github.com/Pylons/pyramid/issues/1357およびhttps://github.com/Pylons/pyramid/pull/1837を参照してください。
  • `` pyramid.request.Request``をサブクラス化し、 `` pyramid.request.Request.add_request.method``を使うことも可能です。 https://github.com/Pylons/pyramid/issues/1529を参照してください。
  • `` pyramid.config.Configurator``は、アクションがコミットサイクル中に他のアクションを呼び出すことを可能にする機能を拡張しました。これにより、他のアクションを呼び出す機能や、競合検出を改善するためにそれらをグループ化する機能など、より多くのロジックをアクションに配置できます。また、適合したアドオンの構築をさらに支援するために、Pyramidが使用する設定フェーズを公開し、文書化しました。 https://github.com/Pylons/pyramid/pull/1513を参照してください。
  • `` config.add_request_method``で設定されたリクエストエクステンションを適用するためのテストで使用できる `` pyramid.request.apply_request_extensions``関数を追加してください。以前は、Pyramidのルーターを経由して拡張機能をテストすることしかできませんでした。 https://github.com/Pylons/pyramid/pull/1581を参照してください。
  • scaffold引数を指定せずに実行すると、足りないフラグに関する情報だけでなく、使用可能な足場のリストも表示されるようになりました。 https://github.com/Pylons/pyramid/pull/1566およびhttps://github.com/Pylons/pyramid/issues/1297を参照してください。
  • ToxとTravisの下に &#39;pypy3&#39;のサポート/テストを追加しました。 https://github.com/Pylons/pyramid/pull/1469を参照してください。
  • py2の代わりにpy2とpy3のコードカバレッジメトリックを自動化します。 https://github.com/Pylons/pyramid/pull/1471を参照してください。
  • 静的リソース用のキャッシュ破棄が追加され、 `` pyramid.config.Configurator.add_static_view``: `` cachebust``の新しい引数で利用できます。コアAPIは、クエリ文字列とパスセグメントによるキャッシュ破棄のために出荷され、カスタムアセットパイプラインに適合するように拡張できます。 https://github.com/Pylons/pyramid/pull/1380およびhttps://github.com/Pylons/pyramid/pull/1583を参照してください。
  • `` Configurator``が作成されたパッケージに関連するリソースを解決したいインクルード可能なパッケージを支援するために `` pyramid.config.Configurator.root_package``属性とinitパラメータを追加してください。これは、設定からアセット仕様をロードする必要のあるアドオンで特に便利です。その場合、開発者がトップレベルパッケージを基準にしてインポートまたはアセットを定義するのが自然かもしれません。 https://github.com/Pylons/pyramid/pull/1337を参照してください。
  • デバッグを支援する足場のログフォーマッタに行番号を追加しました。 https://github.com/Pylons/pyramid/pull/1326を参照してください。
  • `` pyramid.httpexceptions``のステータスコード `` 428前提条件必須 &quot;、&quot; 429 &quot;、&quot; 431リクエストヘッダフィールドが大きすぎます &quot;という新しいHTTP例外オブジェクトを追加しました。 https://github.com/Pylons/pyramid/pull/1372/filesを参照してください。
  • `` pshell``スクリプトは、インタープリタを起動する前に環境に定義されている場合、 `` PYTHONSTARTUP``ファイルを読み込みます。 https://github.com/Pylons/pyramid/pull/1448を参照してください。
  • デフォルトの例外レスポンス・ビューを使用するが、変更された述部およびその他の構成オプションを使用したい、ノーファンドおよび禁止ビューを簡単に定義できるようにする。 `` view``引数は、 `` config.add_notfound_view``と `` config.add_forbidden_​​view``ではオプションです。https://github.com/Pylons/pyramid/issues/494を参照してください。
  • `` pcreate``シェルスクリプト出力の可読性を大幅に改善します。 https://github.com/Pylons/pyramid/pull/1453を参照してください。
  • `` AuthTktCookieHelper``と `` SignedCookieSessionFactory``クラスのタイミング攻撃に対する堅牢性を向上させるには、stdlibの `` hmac.compare_digest``が利用可能な場合(Python 2.7.7+や3.3+など)、 https://github.com/Pylons/pyramid/pull/1457を参照してください。
  • アセットは、 `` config.override_asset`` APIを使用するとき、ファイルシステム上の絶対パスによって上書きされるようになりました。これにより、 `` request.static_url`` APIと `` config.add_static_view``を使えるようにしながら、変更可能なディレクトリから静的コンテンツを提供することを完全にサポートすることができます。以前は、 `` config.add_static_view``を絶対パス**と**を使ってコンテンツにURLを生成することはできませんでした。この変更は `` config.add_static_view( &#39;/ abs / path&#39;、 &#39;static&#39;) ``を `` config.add_static_view( &#39;myapp:static&#39;、 &#39;static&#39;) ``と `` config &#39;に置き換えます。 override_asset(to_override = &#39;myapp:static /&#39;、override_with = &#39;/ abs / path /&#39;) ``です。 `` myapp:static``アセット仕様は完全に作られており、存在する必要はありません。これは `` request.static_url( &#39;myapp:static / foo.png&#39;) ``でURLを生成するために使用されます。 https://github.com/Pylons/pyramid/issues/1252を参照してください。
  • カスタム `` Response``クラスを返すファクトリを定義するための `` Configurator``に `` pyramid.config.Configurator.set_response_factory``と `` response_factory``キーワード引数を追加しました。 https://github.com/Pylons/pyramid/pull/1499を参照してください。
  • イテレータがレンダラから返されるようにします。以前は、バイトまたはユニコードを返すことしかできませんでした。 https://github.com/Pylons/pyramid/pull/1417を参照してください。
  • `` pserve``は `` -b``または `` --browser``オプションを使って、WebブラウザでサーバURLを開きます。 https://github.com/Pylons/pyramid/pull/1533を参照してください。
  • `` proutes``コマンドの全体的な改良。コマンドに `` --format``と `` --glob``引数を追加し、利用可能なリクエストメソッドを表示するための `` method``カラムを導入し、 `` view``の出力を改善しました。ちょうど `` __repr__``です。 https://github.com/Pylons/pyramid/pull/1488を参照してください。
  • Python 3のビューでキーワードのみの引数と関数アノテーションをサポートしています。https://github.com/Pylons/pyramid/pull/1556を参照してください。
  • `` request.response``は `` pyramid.renderers.render_to_response() `` APIを使用してもはや変更されません。レンダラーにカスタム応答オブジェクトを提供したい場合は、 `` render_to_response``に `` response = ``引数を渡す必要があります。それを渡さないと、アプリケーションの `` IResponseFactory``を使ってレスポンスオブジェクトが作成されます。ほぼすべてのレンダラーが `` request.response``レスポンスオブジェクトを変更します(例えば、JSONレンダラーは `` application / json``に `` request.response.content_type``を設定します)。しかし、 `` render_to_response``を呼び出すとき、返される応答オブジェクトは、要求の中で後で使用されるものと同じであるとは限りません。 `` render_to_response``から返された応答オブジェクトは、 `` request.response``と明示的に異なっています。これはレンダラーのAPIを変更しません。 https://github.com/Pylons/pyramid/pull/1563を参照してください。
  • `` Configurator()。add_notfound_view() ``の `` append_slash``引数は、 `` IResponse``インターフェースを実装したものを受け入れ、デフォルトの `` HTTPFound``の代わりにレスポンスクラスとして使用します。 https://github.com/Pylons/pyramid/pull/1610を参照してください。

バグの修正

  • JSONPレンダラーはJavaScriptコードを作成し、コールバック変数を使用して任意にjavascriptを応答オブジェクトに挿入することができます。 https://github.com/Pylons/pyramid/pull/1627
  • `` pserve --reload``がpdbセッション中にリロードされた場合、ターミナルエコーを無効にしてしまう問題を回避してください。 https://github.com/Pylons/pyramid/pull/1577https://github.com/Pylons/pyramid/pull/1592を参照してください。
  • `` pyramid.wsgi.wsgiapp``と `` pyramid.wsgi.wsgiapp2``は、誤って `` None``を渡したときに `` ValueError``を送出します。 https://github.com/Pylons/pyramid/pull/1320を参照してください。
  • イントロスペクティブでは述語がmaybe_dottedとして解決されますが、登録に渡されたときには述語が解決されないという問題を修正しました。これは、例えば `` add_route_predicate``が文字列を受け取り、それを実際の呼び出し可能な関数に変換することができないことを意味します。 https://github.com/Pylons/pyramid/pull/1306を参照してください。
  • `` pyramid.testing.setUp``が適切なパッケージで `` Configurator``を返すように修正しました。以前は、テスト中に返された `` Configurator``を使ってパッケージ相対インクルードを行うことはできませんでした。この動作を上書きできる `` package``引数があります。 https://github.com/Pylons/pyramid/pull/1322を参照してください。
  • `` pyramid.response.FileResponse``が、それが属していない文字セットを適用するかもしれない問題を修正しました。 https://github.com/Pylons/pyramid/pull/1251を参照してください。
  • Pythonの以前のバージョンとは違って、 `` mimetypes.guess_type``がコンテンツタイプのstrではなくUnicodeを返すWindows上のPython 2.7.7で導入されたバグを回避しましょう。詳細については、https://github.com/Pylons/pyramid/issues/1360を参照してください。
  • `` pcreate``はハイフンをアンダースコアに変換することでパッケージ名を正規化します。 https://github.com/Pylons/pyramid/pull/1376を参照してください。
  • 最終応答/完了コールバックで問題を修正し、別のコールバックをリストに追加できないようにしました。 https://github.com/Pylons/pyramid/pull/1373を参照してください。
  • さまざまなOSの異なるMIMEタイプに起因する失敗したユニットテストを修正しました。 https://github.com/Pylons/pyramid/issues/1405を参照してください。
  • パスのない静的ビューのアセット仕様のルート生成を修正しました。 https://github.com/Pylons/pyramid/pull/1377を参照してください。
  • 有効なリクエストオブジェクトがなくても、 `` pyramid.renderers.JSONP``レンダラを動作させることができます。この場合、オブジェクトをコールバックにラップすることはないので、 `` pyramid.renderers.JSON``レンダラーのように動作します。 https://github.com/Pylons/pyramid/pull/1561を参照してください。
  • Prevent &quot;パラメータは非推奨です&quot; `` DeprecationWarning``からsetuptools&gt; = 11.3。 https://github.com/Pylons/pyramid/pull/1541を参照してください。
  • renderer =`引数を使用してビューにアタッチするときにスレッド間で ` IRenderer``オブジェクトを共有することを避けてください。これらのレンダラーは最初のレンダリング時にインスタンス化され、要求間で共有され、 pyramid.reload_templates = true`のような微妙な効果を引き起こし、 pyramid_mako`で機能しませんでした。 https://github.com/Pylons/pyramid/pull/1575およびhttps://github.com/Pylons/pyramid/issues/1268を参照してください。
  • CSRFトークンに対するタイミング攻撃を回避する。 https://github.com/Pylons/pyramid/pull/1574を参照してください。
  • `` request.finished_callbacks``と `` request.response_callbacks``はデフォルトで `` None``ではなく `` iterable``になりました。長さが0であるかどうかを調べることができます。これは1.5の動作です。

廃止

  • `` pserve``コマンドのデーモン化機能は廃止されました。これには、 `` --daemon``、 `` --stop-server``、 `` -pid-file``、 `` -daemon``と同様に、 ``開始、停止、再起動、ステータス ``サブコマンドも含まれます。 `` --status``フラグ。

    `` pserve``に依存するのではなく、実際のプロセスマネージャを使って、自分自身をデーモン化してください。あなたのオペレーティングシステムのサービス(SystemdやUpstartなど)やサーカスやスーパーバイザなどのPythonベースのソリューションを含む多くのオプションが存在します。

    https://github.com/Pylons/pyramid/pull/1641を参照してください。

  • 目的を明確にするために、 `` principal``引数を `` pyramid.security.remember() ``から `` userid``に改名しました。 https://github.com/Pylons/pyramid/pull/1399を参照してください。

ドキュメント

  • `` Configurator.add_view``の `` accept``のドキュメントをもはや述語リストの一部に移動しませんでした。 `` not_``が `` accept``で失敗したというバグレポートについては、https://github.com/Pylons/pyramid/issues/1391を参照してください。 @mcdoncとの議論は、それが述語として文書化されるべきではないという結論に導いた。このPRについては、https://github.com/Pylons/pyramid/pull/1487を参照してください。
  • クイックチュートリアルのiniファイルからロギング設定を削除しました。スキャフォールディングやロギング関連の章を除いて、早すぎる説明は不要です。
  • `` ISession.invalidate`` APIドキュメントの暗黙の詳細を明確にしてください。
  • ピラミッドがセキュリティAPIで「プリンシパル」と「ユーザーID」と定義しているドキュメントを改善し、明確にします。 https://github.com/Pylons/pyramid/pull/1399を参照してください。
  • コマンドラインプログラムのドキュメントを追加する( `` p * ``スクリプト)。 https://github.com/Pylons/pyramid/pull/2191を参照してください。

足場

  • 足場に使用するためのピラミッドとピラミッドのドキュメントのバージョンを返すように足場を生成する機械を更新します。開始版、錬金術、zodbのテンプレートを更新し、正しくバージョン管理されたドキュメントへのリンクを提供し、足場を生成するために使用されたピラミッドを反映させました。
  • テンプレートから非ascii著作権シンボルを削除しました。これにより、足場がプロジェクト生成に失敗する原因となりました。
  • scaffolding funcテストは、 `` tox py2-scaffolds``と `` tox py3-scaffolds``を使って実行できます。

1.5(2014-04-08)

  • Python 3.4との互換性。
  • おそらく変更された `` sys.modules``を反復するとき、Py3kの `` pserve --reload``でクラッシュを避けてください。
  • 秘密に上位の文字が含まれていると、 `` UnencryptedCookieSessionFactoryConfig``が失敗しました。 https://github.com/Pylons/pyramid/issues/1246を参照してください。
  • `` UnencryptedCookieSessionFactoryConfig``と `` SignedCookieSessionFactory``のバグを修正しました。 `` timeout = None``を指定すると、常に新しいセッションが作成されます。また、 `` SignedCookieSessionFactory``の `` reissue_time = None``は、セッションを変更する際に例外を引き起こします。 https://github.com/Pylons/pyramid/issues/1247を参照してください。
  • ドキュメンテーションとスキャフォールドを更新し、 ``ングワ(Lingua) の新バージョン2.0を続ける。これには、すべての ` setup.cfg``ファイルを足場やドキュメント環境から削除することが含まれていました。

1.5b1(2014-02-08)

特徴

  • 我々は、もはや `` request.exception``と `` request.exc_info``を例外ビューtweenで熱心にクリアしません。これにより、完了したコールバック内の例外情報を検査することができます。 https://github.com/Pylons/pyramid/issues/1223を参照してください。

1.5a4(2014-01-28)

特徴

  • 新しいテーマ、固定ドキュメント、サンプルプロジェクトで足場を更新しました。

バグの修正

  • 新しいバージョンのWebObに依存して、Pyramidの機能性を支える重要なバグフィックスを引き出します。
  • 末尾のセミコロンをJSONPレスポンスに追加します。これにより、古いIEバージョンのJavaScript構文エラーが修正されます。 https://github.com/Pylons/pyramid/pull/1205を参照してください。
  • コンフィグレータの `` set_request_property``メソッドが使用されたとき、またはコンフィグレータの `` add_request_method``メソッドが `` property = True``属性とともに使われたときにメモリリークを修正しました。 https://github.com/Pylons/pyramid/issues/1212を参照してください。

1.5a3(2013-12-10)

特徴

  • 要求のメソッドとして許可APIが追加されました: `` request.has_permission``。

    `` request.has_permission``は `` pyramid.security.has_permission`` APIのメソッドベースの代替であり、まったく同じ働きをします。古いAPIは廃止されました。

  • 認証データへのアクセスを容易にするために、プロパティAPI属性がリクエストに追加されました: `` request.authenticated_userid``、 `` request.unauthenticated_userid``、 `` request.effective_principals``です。

    これらは、それぞれ `` pyramid.security.authenticated_userid``、 `` pyramid.security.unauthenticated_userid``、および `` pyramid.security.effective_principals``のアナログです。要求を受け入れる関数ではなく、要求の属性である点を除いて、まったく同じように動作します。それらはプロパティなので、割り当てることはできません。古い関数ベースのAPIは非推奨になりました。

  • Pyramidのコンソールスクリプト( `` pserve``、 `` pviews``など)は、実行時にPythonインタプリタにカスタム引数を送ることができるようになりました。例えば::

    python -3 -m pyramid.scripts.pserve development.ini
    
  • `` pyramid.exceptions.BadCSRFToken``という名前の `` HTTPBadRequest``の特定のサブクラスを追加しました。これは `` check_csrf_token``の失敗に対応して呼び出されます。 https://github.com/Pylons/pyramid/pull/1149を参照してください。

  • `` UnencryptedCookieSessionFactoryConfig``に非常に似ていますが、署名にもっと焦点を当てた新しい `` SignedCookieSessionFactory``を追加しました。この関数のカスタムシリアライザ引数は、シリアライザにも署名を実行することを要求していた前のバージョンとは異なり、シリアライズにのみ焦点を合わせる必要があります。 https://github.com/Pylons/pyramid/pull/1142を参照してください。 `` SignedCookieSessionFactory``を使って生成されたクッキーは `` UnencryptedCookieSessionFactory``を使って生成されたクッキーと互換性がないので、既存のユーザセッションデータはあなたがそれに切り替えると破壊されることに注意してください。

  • 独自のセッション実装を作成するためにフレームワーク実装者が使用できる汎用クッキーファクトリとして機能する新しい `` BaseCookieSessionFactory``を追加しました。これは、再利用、タイムアウト、および `` Session API`の適合性を適切に処理する辞書のようなオブジェクトを提供することに厳密に焦点を当てた、再利用可能なAPIを提供します。 https://github.com/Pylons/pyramid/pull/1142を参照してください。

  • `` pyramid.request.Request.route_url``と `` pyramid.request.Request.resource_url``のアンカー引数とその派生派生物は、最小の適合性を保証するためにURLクォートでエスケープされます。 https://github.com/Pylons/pyramid/pull/1183を参照してください。

  • 外部URLが生成されているときに `` pyramid.request.Request.static_url``に `` _query``と `` _anchor``オプションを送ることを許可します。 https://github.com/Pylons/pyramid/pull/1183を参照してください。

  • `` pyramid.request.Request.route_url``と `` pyramid.request.Request.resource_url``とその派生語に文字列を `` _query``引数として送ることができます。リストまたは辞書の代わりに文字列が送信されるとき。それはURLで引用されますが、 `` k = v``形式である必要はありません。これは、 `` x-www-form-urlencoded``とは異なるクエリ文字列形式を使用できるようにする場合に便利です。 https://github.com/Pylons/pyramid/pull/1183を参照してください。

  • `` pyramid.testing.DummyRequest``には新しいWebOb 1.3 APIにマッチする `` domain``属性が追加されました。その値は `` example.com``です。

バグの修正

  • ターゲットディレクトリ名がスラッシュで終わっても、動作していないプロジェクトディレクトリ構造が生成されないように、 `` pcreate``スクリプトを修正してください。これまでは、 `` pcreate -s startter / foo / bar / ``と言っても、 `` pcreate -s starter / foo / bar``とは異なる出力を生成していました。前者は正しく機能しませんでした。
  • `` ACLAuthorizationPolicy``の `` principals_allowed_by_permission``メソッドを修正し、リソース上で呼び出し可能な `` __acl__``を予期します。以前は、呼び出し可能であれば `` __acl__``を呼び出そうとしませんでした。
  • `` pviews``スクリプトは、urlがトラバーサルを実行するためにカスタムリクエストメソッドを必要とするときには機能しませんでした。 `` pyramid.config.Configurator.add_request_method``で追加されたカスタムメソッドと記述子が表示され、トラバーサルを続行できます。 https://github.com/Pylons/pyramid/issues/1104を参照してください。
  • 未使用の `` renderer``引数を `` Configurator.add_route``から削除してください。
  • `` BasicAuthenticationPolicy``が非ASCIIのユーザ名とパスワードで動作することを許可します。この文字セットはヘッダーの一部として渡されず、さまざまなブラウザーがUTF-8とLatin-1を交互に使用するため、ポリシーはまずUTF-8でデコードしようとし、Latin-1にフォールバックします。 https://github.com/Pylons/pyramid/pull/1170を参照してください。
  • `` @ view_defaults``は修飾されたクラスのメソッドとして定義されているnotfoundビューとforbiddenビューに適用されます。 https://github.com/Pylons/pyramid/issues/1173を参照してください。

ドキュメンテーション

  • クイックツアーには&quot;クイックチュートリアル&quot;が追加されました
  • docsから `` pyramid_beaker``を削除しました。ビーカーはもはや維持されていません。代わりに、 `` pyramid_redis_sessions``をポイントします。
  • `` pyramid.interfaces.IRendererFactory``と `` pyramid.interfaces.IRenderer``のドキュメントを追加してください。

後方の非互換性

  • `` request.route_url``の `` _query``パラメータと `` request.resource_url``の `` query``パラメータ(とその変形)のキー/値は、 `` None``を文字列 `` &#39;None&#39;``として返し、結果のクエリ文字列を `` a = b&key = None``のままにします。この状況では値が削除され、 `` a = b&key = ``というクエリ文字列が残っています。 https://github.com/Pylons/pyramid/issues/1119を参照してください。

廃止

  • `` pyramid.interfaces.ITemplateRenderer``インタフェースを非推奨にしてください。 MakoとChameleonのテンプレートバインディングを独自のパッケージに分割すると、定義が不明瞭になり、使用されなくなりました。
  • `` pyramid.session.UnencryptedCookieSessionFactoryConfig`` APIは廃止され、 `` pyramid.session.SignedCookieSessionFactory``に置き換えられました。 `` UnencryptedCookieSessionFactoryConfig``によって生成されたクッキーは古いリリースで生成されたクッキーと互換性がありますが、SignedCookieSessionFactoryによって生成されるクッキーはそうではありません。 https://github.com/Pylons/pyramid/pull/1142を参照してください。
  • `` pyramid.security.has_permission`` APIは廃止されました。代わりに、要求オブジェクトの新しく追加された `` has_permission``メソッドを使用してください。
  • `` pyramid.security.effective_principals`` APIは廃止されました。代わりに、要求オブジェクトの新しく追加された `` effective_principals``属性を使用してください。
  • `` pyramid.security.authenticated_userid`` APIは廃止されました。代わりに、要求オブジェクトの新しく追加された `` authenticated_userid``属性を使用してください。
  • `` pyramid.security.unauthenticated_userid`` APIは廃止されました。代わりに、要求オブジェクトの新しく追加された `` unauthenticated_userid``属性を使用してください。

依存関係

  • PyramidはWebOb&gt; = 1.3(1.3+から `` webob.cookies.CookieProfile``を使います)に依存しています。

1.5a2(2013-09-22)

特徴

  • ユーザは、 `` add_ {view、route、subscriber} _predicate``という名前のConfiguratorメソッドを `` factory``引数としてドット付きのPython名を提供できるようになりました(述語ファクトリを直接渡すのではなく、工場へ)。

バグの修正

  • `` __file__`属性を持たない名前空間パッケージのパッケージ名を解決する際に、 `` pyramid.path.package_name``に例外を修正しました。

後方の非互換性

  • Pyramidは、デフォルトでMakoとChameleonのテンプレートシステムレンダラに依存したり、設定したりしません。デフォルトでこれらのテンプレートシステムを含めないということは、Pyramidコアの依存性が少なく、テンプレートアドオンの互換性がすぐに気になることなく将来のプラットフォームで実行できることを意味します。 Pyramidコアへのコミットアクセスを必要とせずに理解して気にするテンプレートシステムのアドオンをメンテナンスできるようになり、メンテナンスが少し効率的になります。彼らはピラミッドをインストールするときに乗るために来ることはありません。

    つまり、Pyramid 1.5a2 +にアップグレードすると、これらのテンプレートシステムのいずれかを使用するプロジェクトで、アプリケーションがカメレオンまたはMakoテンプレートをレンダリングしようとすると、次のような終わりのトレースバックが表示されます。

    ValueError: No such renderer factory .pt
    

    または:

    ValueError: No such renderer factory .mako
    

    または:

    ValueError: No such renderer factory .mak
    

    Makoテンプレートのサポートは `` pyramid_mako``というアドオンパッケージに移行し、カメレオンテンプレートのサポートは `` pyramid_chameleon``というアドオンパッケージに移行しました。これらのパッケージは、これらのテンプレートランゲージの古い組み込みサポートのためのドロップイン置換です。インストールするだけで設定を有効にして、 `` .pt``や `` .mako``(または `` .mak``)のレンダラファクトリを登録してアプリケーションを再び動作させるだけです。

    ChameleonまたはMakoテンプレートレンダラーのサポートを既存のプロジェクトに再度追加するには、以下の手順に従います。

    Makoテンプレートに依存している場合:

    • `` pyramid_mako``パッケージがインストールされていることを確認してください。これを行う1つの方法は、パッケージの `` setup.py``ファイルの `` install_requires``セクションに `` pyramid_mako``を追加した後、 `` setup.py develop``を再実行することです:

      setup(
          #...
          install_requires=[
              'pyramid_mako',         # new dependency
              'pyramid',
              #...
          ],
      )
      
    • Pyramidの `` pyramid.config.Configurator``(プロジェクトの `` __init __。py``ファイルの `` main() ``関数であることが多い)をインスタンス化するアプリケーションの部分では、Pyramidに `` ピラミッド・マコ ` includeme

      config = Configurator(.....)
      config.include('pyramid_mako')
      

    カメレオンのテンプレートに依存している場合:

    • `` pyramid_chameleon``パッケージがインストールされていることを確認してください。これを行う1つの方法は、パッケージの `` setup.py``ファイルの `` install_requires``セクションに `` pyramid_chameleon``を追加し、 `` setup.py develop``を再実行することです:

      setup(
          #...
          install_requires=[
              'pyramid_chameleon',         # new dependency
              'pyramid',
              #...
          ],
      )
      
    • Pyramidの 〜pyramid.config.Configurator`(プロジェクトの `` __init __。py``ファイルの `` main() ``関数であることが多い)をインスタンス化するアプリケーションの部分で、Pyramidに ` `pyramid_chameleon includeme

      config = Configurator(.....)
      config.include('pyramid_chameleon')
      

    これらのパッケージを互換性のために古い*ピラミッドにインストールすることもできます。 Pyramid 1.5に直ちにアップグレードしなくても、Pyramid 1.4のインストールで上記の手順を実行すると問題はありません。Pyramid 1.5にアップグレードすると、互換性があります。

    コアからのMakoとChameleonのサポートを削除すると、 `` pyramid.renderers.render * ``メソッドを使用するいくつかの単体テストが失敗することがあります。あなたのユニットテストのいずれかがMakoかChameleonのいずれかのテンプレートで `` pyramid.renderers.render() ``または `` pyramid.renderers.render_to_response() ``を呼び出す場合、 `` pyramid.config.Configurator``インスタンス上記のようにアドオンを含むように更新する必要があります。例えば::

    class ATest(unittest.TestCase):
        def setUp(self):
            self.config = pyramid.testing.setUp()
            self.config.include('pyramid_mako')
    
        def test_it(self):
            result = pyramid.renderers.render('mypkg:templates/home.mako', {})
    

    または:

    class ATest(unittest.TestCase):
        def setUp(self):
            self.config = pyramid.testing.setUp()
            self.config.include('pyramid_chameleon')
    
        def test_it(self):
            result = pyramid.renderers.render('mypkg:templates/home.pt', {})
    
  • Pyramidデバッグツールバーを使用している場合は、Pyramidを1.5a2 +にアップグレードする際に、Pyramid 1.5と互換性がないため、Pyramid_debugtoolbarパッケージを少なくとも1.0.8にアップグレードする必要があります。 a2 +はコアからのMakoサポートの削除によるものです。旧バージョンのPyramidsでもこの新しいバージョンのツールバーコードを使用するのは良いことです。

  • `` request.response_ * ``属性を削除しました。これらの属性は、Pyramid 1.1以降、非推奨ポリシーに従って廃止されました。

  • `` request.response``は `` pyramid.renderers.render() `` APIを使うときにもはや変更されません。ほとんどのレンダラが `` request.response``レスポンスオブジェクトを変更します(例えば、JSONレンダラが `` application / json``に `` request.response.content_type``を設定します)が、これはレンダラが応答を生成する。それは `` pyramid.renderers.render() ``を呼び出す副作用として行われたときのバグでした。

  • `` bfg2pyramid``フィーダスクリプトを削除しました。

  • ** `** pyramid.events.NewResponse``イベントは**応答コールバックが実行された後に送信されます。以前は応答コールバックが実行される前に実行されていました。理論的根拠:応答コールバックが前回ではなく仕事をした後に、応答を検査できる方が便利です。

  • Pyramid 1.1以来廃止されていた `` pyramid.view.static``という名前のクラスを削除しました。その代わりに `` py_id_static.static_view``を `` use_subpath = True``引数とともに使用してください。

  • Pyramid 1.1以来廃止されていた `` pyramid.view.is_response``関数を削除しました。代わりに `` pyramid.request.Request.is_response``メソッドを使用してください。

  • `` pyramid.config.Configurator.add_route``: `` view``、 `` view_context``に以下の引数を渡す機能を削除しました。 `` view_for``、 `` view_permission``、 `` view_renderer``、 `` view_attr``です。これらの引数を使用することは、Pyramid 1.1以降では廃止されました。ビュー関連の引数を `` add_route``に渡すのではなく、 `` pyramid.config.Configurator.add_view``を別々に呼び出して、 `` route_name``引数を使ってビューをルートに関連づけます。これは `` pyramid.config.Configurator.add_static_view``関数にも影響します。なぜなら、それは `` add_route``に委譲するからです。

  • `` pyramid.request.Request``オブジェクトに影響を及ぼす機能を辞書のように削除しました。以前は、 `` __getitem__``、 `` get``、 `` items``などのメソッドを使用して、WSGI環境の値にアクセスするためのメソッドを使用することができました。この動作はPyramid 1.1以降では廃止されました。代わりに、 `` request.environ``(実際の辞書)のメソッドを使用してください。

  • `` pyramid.traversal.DefaultRootFactory``の古くからの互換性のあるハックを削除し、BFG 0.9との互換性のためのマッチディック値で工場の `` __dict__``を設定しました。

  • `` pyramid.config.Configurator`コンストラクタの `` renderer_globals_factory``引数と `` setup_registry``メソッドは削除されました。 `` pyramid.config.Configurator``の `` set_renderer_globals_factory``メソッドも削除されました。 (内部の) `` pyramid.interfaces.IRendererGlobals``インターフェースも削除されました。これらの引数、メソッド、およびインタフェースは、1.1以降で非難されていました。コンフィギュレータにレンダラグローバル値を提供するのではなく、ピラミッドの説明文書の&quot;Hooks &quot;章に書かれているように、 `` BeforeRender``イベントサブスクライバを使用してください。

廃止

  • `` pyramid.config.Configurator.set_request_property``メソッドは、使用時に非推奨警告を発行するようになりました。 1.4ではdocs-deprecatedとなっていましたが、使用すると非推奨の警告は発行されませんでした。

1.5a1(2013-08-30)

特徴

  • `` pyramid.httpexceptions.HTTPSuccessful``という名前の新しいhttp例外サブクラスが追加されました。このクラスを例外ビューの `` context``として使用して、すべての200シリーズ&quot;例外&quot;(たとえば &quot;raise HTTPOk &quot;)をキャッチすることができます。これはまた、 `` HTTPOk``例外自体を捕まえることができます。他の多くの例外( `` HTTPNoContent``など)は `` HTTPOk``から継承されましたが、今はそうではありません。

  • `` request.resource_url``と `` requestに新しい `` route_name``、 `` route_kw``、 `` route_remainder_name``引数を使うことで、より簡単に&quot;hybrid &quot; urldispatch / traversal URLを生成することができます。 resource_path``です。 &quot;ハイブリッドURL生成&quot;と題された&quot;トラバースとURLディスパッチの結合&quot;ドキュメントの章の新しいセクションを参照してください。

  • Pyramid足場で二重の括弧をエスケープすることが可能になりました(エスケープされていない、これらは置換値を表しています)。 `` {{a } } ``を使って&quot;bare &quot; `` {{a}} ``を表すことができます。 https://github.com/Pylons/pyramid/pull/862を参照してください。

  • リクエストに `` localizer``と `` locale_name``のプロパティー(reified)を追加してください。 https://github.com/Pylons/pyramid/issues/508を参照してください。 `` pyramid.i18n.get_localizer``と `` pyramid.i18n.get_locale_name``関数は、単にリクエストでこれらのプロパティを検索するようになりました。

  • 使用中のPythonバージョン、使用中のPyramidバージョン、現在インストールされているすべてのPythonディストリビューションのバージョン番号と場所を表示する `` pdistreport``スクリプトを追加してください。

  • `` not_``クラスを使ってビュー、ルート、サブスクライバ述語の結果を逆転させる機能を追加します。例えば::

    from pyramid.config import not_
    
    @view_config(route_name='myroute', request_method=not_('POST'))
    def myview(request): ...
    

    上記の例では、リクエストメソッドがPOSTでない場合(少なくとも他のビューがより特定的でない場合)、ビューが確実に呼び出されます。

    `` pyramid.config.not_``クラスは、これらのコンテキストのいずれかで渡される述語値である任意の値に対して使用できます。

    • `` pyramid.config.Configurator.add_view``
    • `` pyramid.config.Configurator.add_route``
    • `` pyramid.config.Configurator.add_subscriber``
    • `` pyramid.view.view_config``
    • `` pyramid.events.subscriber``
  • `` scripts / prequest.py``: `` PUT``と `` PATCH``要求を提出するためのサポートを追加します。 https://github.com/Pylons/pyramid/pull/1033を参照してください。 `` OPTIONS``と `` PROPFIND``リクエストを提出するためのサポートを追加し、ユーザがスクリプトの `` --login``引数を使って要求の中で基本認証資格を指定できるようにします。 https://github.com/Pylons/pyramid/pull/1039を参照してください。

  • `` ACLAuthorizationPolicy``は、 `` __acl__``を呼び出し可能としてサポートしています。これは、プロパティが定義されていないときに `` context``で生成される可能性のある `` AttributeError``と動的プロパティ内のユーザ定義コードから生成される `` AttributeError``のあいまいさを取り除きます。このあいまいさを避けるために、動的ACLを呼び出し可能として定義することをお勧めします。 https://github.com/Pylons/pyramid/issues/735を参照してください。

  • `` pyramid.config.Configurator.add_static_view``に渡すプロトコル相対URL( `` // example.com / images``など)を許可します。これにより、外部でホストされている静的URLを現在のプロトコルに基づいて生成することができます。

  • `` AuthTktAuthenticationPolicy``にはドメイン使用を設定するための2つの新しいオプションがあります:

    • `` parent_domain``:もし設定されていれば、認証クッキーは親ドメイン上に設定されます。複数のサイトが同じドメインを共有している場合に便利です。
    • `` domain``:提供されていれば、いつものすべてのロジックをバイパスして、このドメインに対して常にクッキーが設定されます。

    https://github.com/Pylons/pyramid/pull/1028https://github.com/Pylons/pyramid/pull/1072およびhttps://github.com/Pylons/pyramid/pull/1078を参照してください。

  • `` AuthTktAuthenticationPolicy``は `` include_ip = True``オプションを使うときにIPv6アドレスをサポートするようになりました。これは、仕様がIPv6を適切に扱う方法を定義していないため、代替の `` auth_tkt``実装とは互換性がありません。 https://github.com/Pylons/pyramid/issues/831を参照してください。

  • `` pyramid.paster.get_appsettings``で可変引数を使うことができます。これにより、生成された `` alchemy`` scaffoldの `` initialize_db``スクリプトは `` a = 1 b = 2``の形式でオプションをサポートできるようになり、パラメータ化された `` .ini ``ファイル、例えば `` initialize_myapp_db etc / development.ini a = 1 b = 2``のようなものです。 https://github.com/Pylons/pyramid/pull/911を参照してください。

  • `` request.session.check_csrf_token() ``メソッドと `` check_csrf``ビュー述語は、 `` X-CSRF-Token``という名前のHTTPヘッダーの値を考慮に入れます( `` csrf_token彼らが常にやった ``フォームパラメータ)。フォームパラメータが存在しない場合、ヘッダーが試されます。

  • ビュールックアップは、コンテキストの継承階層に基づいて有効なビューを検索します。最も具体的なコンテキストに基づいてビューを最初に見つけようとします。そして、述部の失敗時に、スーパータイプのコンテキストによって検出されたビューをテストするために継承チェーンを上げます。過去には、ビューを含む最も特定の型だけがチェックされ、一致するビューが見つからない場合には、PredicateMismatchが発生しました。今や述語の不一致は、スーパータイプに登録された有効なビューを隠さない。ここでは今働く例があります:

    class IResource(Interface):
    
        ...
    
    @view_config(context=IResource)
    def get(context, request):
    
        ...
    
    @view_config(context=IResource, request_method='POST')
    def post(context, request):
    
        ...
    
    @view_config(context=IResource, request_method='DELETE')
    def delete(context, request):
    
        ...
    
    @implementer(IResource)
    class MyResource:
    
        ...
    
    @view_config(context=MyResource, request_method='POST')
    def override_post(context, request):
    
        ...
    

    以前は、override_postビューの登録によって、MyResourceのコンテキストでgetおよびdeleteビューが非表示になり、GETメソッドまたはDELETEメソッドを使用しようとしたときに述語の不一致エラーが発生しました。今、ビューが見つかり、述語の不一致が発生しません。 https://github.com/Pylons/pyramid/pull/786およびhttps://github.com/Pylons/pyramid/pull/1004およびhttps://github.com/Pylons/pyramid/pull/1046を参照してください。

  • `` pserve``コマンドは、 `` -v``(または `` - verbose``)フラグと `` -q``(または `` --quiet``)フラグを取るようになりました。 `` pserve``からの出力は、これらのフラグを使って制御することができます。 `` -v``を複数回指定して冗長性を増やすことができます。 `` -q``は冗長に `` 0``を無条件に設定します。デフォルトの冗長レベルは `` 1``です。

  • ``錬金術 ``足場テストは、より良いカバレッジを提供するようになりました。 https://github.com/Pylons/pyramid/pull/1029を参照してください。

  • `` pyramid.config.Configurator.add_route``メソッドは、外部URLをパターンとして呼び出すことをサポートします。詳細については、https://github.com/Pylons/pyramid/issues/611および&quot;URL Route &quot;という章の &quot;URL Dispatch&quot;章のドキュメントのセクションを参照してください。

バグの修正

  • `` pyramid.httpexceptions.HTTPException``を例外ビューの ``コンテキスト ``として使用することは、例外ビューがデフォルトの例外ビューをオーバーライドするようにしたいときに、http関連の例外の非常に一般的なキャッチオールとして使用できませんでした。 https://github.com/Pylons/pyramid/issues/985を参照してください。
  • `` pyramid.reload_templates``の設定が真でカメレオンのテンプレートがリロードされ、マクロ(例えば `` foo#macroname.pt``)のレンダラーの指定があった場合、テンプレートが再ロードされた後のテンプレートのレンダリングファイルを変更すると、マクロのレンダリングだけでなく、テンプレート本体全体が生成されます。 https://github.com/Pylons/pyramid/issues/1013を参照してください。
  • 仮想ルートをそのパターンに `` * traverse``を持つルートと組み合わせるとき、あいまいな問題を修正してください。このような構成で生成されたトラバーサルパスは、先頭のスラッシュがない要素ではなく正しいものになります。
  • 状況によっては、前のdefname値を持つタプルを返すMakoレンダラーのバグを修正しました。詳細については、https://github.com/Pylons/pyramid/issues/1037を参照してください。
  • `` pyramid.config.assets.PackageOverrides``オブジェクトがPEP302で指定された `` __loader__``オブジェクトのAPIを実装するようにします。存在する場合、インポータによって設定される `` __loader__``へのプロキシ。それ以外の場合は、 `` NotImplementedError``を送出します。これにより、Python 3.3では、Pyramidの静的ビューの上書きが適切に機能します(以前はそうではありませんでした)。詳細については、https://github.com/Pylons/pyramid/pull/1015を参照してください。
  • `` mako_templating``:アップストリーム ``マークアップ安全性(markupsafe) &#39;がPython 3.2のサポートを廃止したため、 `` mako``の非インポート可能性に対する防御的な回避策を追加しました。 MarkupSafe 0.17とPython 3.2(MarkupSafe 0.17とPython 3.3の組み合わせ、またはサポートされているPython 2バージョンの組み合わせはOK)でも、MakoテンプレートはMarkupSafe 0.17とPython 3.2の組み合わせでは動作しなくなります。
  • スペースとドットは、makoレンダラーのテンプレートパスに含まれるようになりました。これは1.4a1で新しいmakodef構文のサポートが追加されたときに壊れていました。 https://github.com/Pylons/pyramid/issues/950を参照してください。
  • `` pyramid.debug_authorization = true``は、認証ポリシーの `` permits``メソッドを呼び出す代わりに、 `` NO_PERMISSION_REQUIRED``で登録されたビューに対して `` Allowed``を正しく表示するようになりました。 https://github.com/Pylons/pyramid/issues/954を参照してください。
  • 名前に高次の文字が含まれているテストファイルがパッケージされているため、Pyramidは一部のシステムにインストールできませんでした。これらのファイルは削除されました。 https://github.com/Pylons/pyramid/issues/981を参照してください。
  • `` pyramid.testing.DummyResource``は `` __bool__``を定義しなかったので、Python 3のコードは真実性を見つけるのに `` __len__``を使います。これは通常、DummyResourceのインスタンスを&quot;truthy &quot;ではなく &quot;falsy &quot;にしました。 https://github.com/Pylons/pyramid/pull/1032を参照してください。
  • `` alchemy``の足場は、テーブルが作成されているときにデータベースがMySQLだったときに壊れます。 https://github.com/Pylons/pyramid/pull/1049を参照してください。
  • `` current_route_url``メソッドは、デフォルトでURLにクエリ文字列を添付するようになりました。 https://github.com/Pylons/pyramid/issues/1040を参照してください。
  • `` pserve.cherrypy_server_runner``をPython 3と互換性のあるものにしましょう。 https://github.com/Pylons/pyramid/issues/718を参照してください。

後方の非互換性

  • pyramid.Requestの `` current_route_url``メソッドを修正しました。このメソッドは、以前はデフォルトでクエリ文字列のないURLを返していましたが、オーバーライドされていない限りクエリ文字列を添付しています。
  • 置き換え値に `` / が含まれている場合、 `` route_url``と `` route_path APIはもはや `` / ````%2F``に引用しません。とにかくWSGIサーバーは常にスラッシュを引用符で囲まず、Pyramidは引用された値を決して見ないため、これは無意味でした。
  • リクエストの `` locale_name``属性を設定することも、リクエストの `` localizer``属性を設定することもできません。これらは現在、ドキュメントの&quot;国際化&quot;の章で説明されている機械を使用してロケール名とローカライザをそれぞれ検索する&quot;reified &quot;プロパティです。
  • スラッシュ(または任意の数のスラッシュ)で終わる値を持つ `` X-Vhm-Root``ヘッダーを送信すると、 ``使用するときにURLが生成される前にスラッシュが削除されます。 request.resource_url``または `` request.resource_path``です。以前は、仮想ルートパスに後続のスラッシュが取り除かれていなかったため、URLの生成に影響します。
  • `` pyramid.interfaces.IResourceURL``インターフェースは、 `` virtual_path_tuple``と `` physical_path_tuple``という2つの新しい属性を持ちました。これらは、リソースのパス(物理的および仮想的)のタプル形式でなければなりません。

1.4(2012-12-18)

ドキュメント

  • ZODBチュートリアルの機能テストを修正

1.4b3(2012-12-10)

  • パッケージのリリースのみ、コードの変更はありません。 1.4b2は、tarballのディレクトリがないため、brownbagのリリースとなりました。

1.4b2(2012-12-10)

ドキュメント

  • 足場は現在PEP-8に準拠しています(少なくとも短期間は光る)。
  • チュートリアルの改善。

後方の非互換性

  • `` pyramid.view.view_config``の `` _depth``引数を `` view_config``自身の呼び出しに関連した値を受け入れるように修正しました。したがって、以前に `` 1``またはそれ以上の値を期待していたとき、 `` view_config``の呼び出し元が `` venusian.attach``から1スタックフレーム離れていることを反映するために、この実装の詳細は現在隠されています。
  • 上の &quot;_depth&quot;に記述されている変更と同様に、 `` _backframes``引数を `` pyramid.util.action_method``に変更しました。この議論は文書化されていませんが、狂人の中には野生でも使われるかもしれません。

1.4b1(2012-11-21)

特徴

  • `` pyramid.response.Response``オブジェクトがビューから返される可能性があることを予期する小さな微小速度の拡張です。ビューによって返されるオブジェクトのクラスがこのクラスである場合、いくつかのコードはショートカットです。同様の微小最適化が `` pyramid.request.Request.is_response``に対して行われました。

  • `` p * コマンド( `` pserve、 `` pshell``、 `` pviews``など)で `` a = 1b = 2``のように可変引数を使うことができるようにしました。 `` pshell etc / development.ini http_port = 8080`のように、パラメータ化された `.ini`ファイルで値を入力することができます。 https://github.com/Pylons/pyramid/pull/714を参照してください。

  • Pyramidイベントハンドラのやや高度であいまいな機能は、&quot;マルチインターフェース&quot;通知を処理する能力です。これらの通知は、伝統的に、複数のオブジェクトを加入者呼び出し可能に提示してきた。たとえば、イベントが次のようなコードで送信された場合:

    registry.notify(event, context)
    

    過去にこのようなイベントを捕まえるには、イベントとコンテキストの両方を引数リストに記述したイベントサブスクライバを作成して登録する必要がありました:

    @subscriber([SomeEvent, SomeContextType])
    def asubscriber(event, context):
        pass
    

    このように登録された多くのサブスクライブ可能なコールバックでは、サブスクライブ可能なサブスクライバのロジックが、2番目以降の引数を完全に無視するのが一般的でした(上記の例の context`は無視されるかもしれません)。とにかくイベント。通常、 ` event.context`またはそれに類するものを使って同じ値を得ることができます。

    あなたが通常は加入者の呼び出し可能な本体で無視した余分な引数を入れる必要があったという事実は、サブスクライバが実行される状況のセットを狭めるために使用される&quot;サブスクライバ述語&quot;が追加されるまで、以前の1.4アルファリリース。それらが追加されると、加入者述部は加入者呼び出し可能変数と同じ引数リストと引数を受け入れる必要があったため、煩わしさが増えました。したがって、たとえば、あなたのコードに次の2つの加入者登録があるとします。

    @subscriber([SomeEvent, SomeContextType])
    def asubscriber(event, context):
        pass
    
    @subscriber(SomeOtherEvent)
    def asubscriber(event):
        pass
    

    また、サブスクライバ述語:

    @subscriber([SomeEvent, SomeContextType], mypredicate=True)
    def asubscriber1(event, context):
        pass
    
    @subscriber(SomeOtherEvent, mypredicate=True)
    def asubscriber2(event):
        pass
    

    既存の `` mypredicate``サブスクライバ述語が、 `` __call__``に1つの引数しか受け付けないように記述されていた場合、そのサブスクライバインタフェースリストに複数のインタフェースを指定したサブスクリプションに対しては使用できません。同様に、2つの引数を受け入れたサブスクライバ述語を記述した場合は、1つのインタフェースタイプのみという名前の登録に対しては使用できません。

    たとえば、この述部を作成したとします:

    class MyPredicate(object):
        # portions elided...
        def __call__(self, event):
            return self.val == event.context.foo
    

    上記の例では、 `` asubscriber1``に対して実行しようとすると、実行時にTypeErrorで失敗し、何かが呼び出されようとしていると主張しています多くの議論。

    この制限を回避するために、あなたは、 `` mypredicate`述語を、 `` __call__``で単一の `` event``引数(SomeOtherEventオブジェクト)*または*の一対の引数のいずれかを受け取るように設計する義務がありました(SomeEventオブジェクトとSomeContextTypeオブジェクト)、おそらくこのような何かをすることによって:

    class MyPredicate(object):
        # portions elided...
        def __call__(self, event, context=None):
            return self.val == event.context.foo
    

    これは混乱して悪いものでした。

    人々が加入者呼び出し可能変数への未使用引数を無視し、イベント加入者と加入者述語の間の関係を正規化するために、加入者と加入者述語の両方が購読していても単一の `` event``引数だけを受け入れることができるようになりました。複数のインタフェースを含む通知の場合1つの引数のみを受け入れるサブスクライバとサブスクライバ述語は、 `` notify``に渡される最初のオブジェクトを受け取ります。これは一般的に(常にではありませんが)イベントオブジェクトです。サブスクリプション検索に含まれる他のオブジェクトは破棄されます。複数のインタフェースにサブスクライブしていても `` event``だけを受け付けるイベントサブスクライバを書くことができるようになりました:

    @subscriber([SomeEvent, SomeContextType])
    def asubscriber(event):
        # this will work!
    

    これにより、特にイベントオブジェクト自体以外のサブスクライバで引数を使用しない場合、サブスクライバ呼び出し可能パラメータをサブスクリプションタイプに不必要に一致させる必要がなくなります。

    ただし、イベントオブジェクトが `` notify``の呼び出しの最初のオブジェクトでない場合、問題に遭遇します。たとえば、最初にcontext引数を指定してnotifyを呼び出すと、

    registry.notify(context, event)
    

    イベントのみの機能を利用することはできません。それは&quot;仕事&quot;ですが、あなたのイベントハンドラが受け取ったオブジェクトはイベントオブジェクトではなく、コンテキストオブジェクトになります。これはあまり役に立ちません:

    @subscriber([SomeContextType, SomeEvent])
    def asubscriber(event):
        # bzzt! you'll be getting the context here as ``event``, and it'll
        # be useless
    

    既存の複数引数のサブスクライバは引き続き問題なく動作します。したがって、システムが複数のインターフェイスを使用して通知し、最初のインターフェイスがイベントインターフェイスでない場合は、引き続き使用する必要があります。例えば::

    @subscriber([SomeContextType, SomeEvent])
    def asubscriber(context, event):
        # this will still work!
    

    イベントのみの機能により、複数のインタフェースの加入者登録と単一のインタフェースの加入者登録の両方で要求引数のみを受け入れる加入者述部を使用することができます。サブスクリプション・タイプの引数に応じて、少し異なる述語を作成する必要はありません。代わりに、すべてのサブスクライバ述語を書くだけで、彼らは `` __call__``に `` event``を受け取り、イベントを最初の引数として使うサブスクリプションのすべての登録にわたって有用です。ちょうど ``イベント ``

    ただし、加入者呼び出し可能パラメータと同じ述語が適用されます。マルチインタフェース・イベントに加入していて、最初のインタフェースがイベント・インタフェースでない場合、述語は正しく機能しません。そのような場合、述部の `` __call__``引数の順序と構成をインタフェースの順序付けと一致させる必要があります。例えば、サブスクリプションの登録が `` [SomeContext、SomeEvent] ``を使用する場合、述語の `` __call__``メソッドのパラメータの順序でそれを反映させる必要があります:

    def __call__(self, context, event):
        return event.request.path.startswith(self.val)
    

    tl; dr:1)マルチインタフェースサブスクリプションを使用する場合は、最初のサブスクリプション登録引数として常にイベントタイプを使用し、2)1がtrueの場合は、サブスクライバサブスクライバパラメータリストに &quot;event&quot;加入者に通知されるインターフェイスの数。この組み合わせにより、サブスクライバ述語の再利用性が最大限に向上し、お客様の思考が最小限に抑えられます。責任をもって飲む。

バグの修正

  • `` debug_routematch``設定が真であるか、 `` pviews``コマンドが使用されたときに、ルートとビューの述語に属性 `` __text__``を配置しようとすると失敗しました。 https://github.com/Pylons/pyramid/pull/727を参照してください。

ドキュメンテーション

  • チュートリアルのソースファイルを、それぞれが使用する足場によってレンダリングされたファイルと同期させます。

1.4a4(2012-11-14)

特徴

  • `` pyramid.authentication.AuthTktAuthenticationPolicy``は、 `` sha512``のような新しいハッシュアルゴリズムをサポートするように更新されました。既存のアプリケーションでは、可能であれば、デフォルトのmd5ハッシュよりもセキュリティを強化するために、更新を考慮する必要があります。
  • `` effective_principals``ルートとビュー述語を追加しました。
  • `` authenticated_userid``または `` effective_principals``で返されたプリンシパルのリストの1つであるuseridが `` system.Everyone``または `` system.Authenticated &quot;のいずれかの文字列になることを許可しないでください`` pyramid.authentication``に組み込まれているビルトインの認証ポリシーが使用されているときに使用します。これらの2つの文字列は、Pyramidによる内部使用のために予約されており、有効なユーザーIDとして受け入れられません。
  • `` pyramid.authentication.RepozeWho1AuthenticationPolicy``からのデバッグログを少し改善しました。
  • `` pyramid.security.view_execution_permitted``は、ビューが見つからない場合に `` True``を返すために使用されます。存在しないビューが実行可能であると主張するのは意味をなさないので、この場合は `` TypeError``例外が発生します。 https://github.com/Pylons/pyramid/issues/299を参照してください。
  • `` pyramid.view.view_config``への `` _depth``引数を許可します。これは、view_configによく似たカスタムデコレータを提供したい他のソフトウェアによるデコレータのコンポジションの再利用を制限します。
  • iterableのデコレータを `` pyramid.config.Configurator.add_view``に渡せるようにします。これにより、デコレータを自分で組み合わせなくても、ビューを複数のデコレータでラップすることができます。

バグの修正

  • 過去にレンダラーが `` None``を返した場合、結果として得られるレスポンスの本文は空の文字列に明示的に設定されます。代わりに、ボディは変更されずにそのまま残されます。レンダラーは、例えば `` request.response.body = b&#39;foo&#39;``を使って本体自体を設定することができます。レンダラーによって設定されたボディは、途中でunmolestされます。 https://github.com/Pylons/pyramid/issues/709を参照してください。
  • まれなケースでは、 `` pyramid_excview_tween_factory``が、リクエストの属性として `` request_iface``を探す `` KeyError``を誤って呼び起こした可能性があります。この場合、もはや失敗しません。 https://github.com/Pylons/pyramid/issues/700を参照してください。
  • `` match_param``と `` physical_path``述語の実装の潜在的なエラー状態をより寛容にしてください。例外を発生させる代わりにFalseを返します。
  • Python 3.xでは、 `` pyramid.view.render_view``はバイト/ユニコードの不一致のため正しく機能しませんでした。 https://github.com/Pylons/pyramid/issues/721を参照してください。

廃止

  • `` pyhalid.authentication.AuthTktAuthenticationPolicy``は、アプリケーションが明示的に `` hashalg``引数を渡さずにポリシーを使用している場合に警告を出します。これは、デフォルトでは理論的には衝突攻撃の対象と見なされる&quot;md5 &quot;であるためです。 &quot;md5 &quot;が本当に必要な場合は、警告を取り除くために明示的に指定する必要があります。

ドキュメンテーション

  • `` pyramid.authentication.AuthTktAuthenticationPolicy``を使用するチュートリアルはすべて、 `` hashalg``引数として明示的に `` sha512``を渡します。

内部

  • `` pyramid.config.util``から `` pyramid.util``に `` TopologicalSorter``を移動し、 `` Pyramid.config.util``から `` pyramid.exceptions``に `` CyclicDependencyError``を移動し、 `` Sentinel``に `` Singleton``の名前を変更し、 `` pyramid.config.util``から `` pyramid.util``に移動します。これは、ある日Pyramid.config.utilからAPIのようなものを移動させるためのものです。ピラミッド以外のコードからそのパッケージをインポートしないでください。 TopologicalSorterはまだAPIではありませんが、1つになる可能性があります。
  • ピラミッドの ​​`` __init __。py``の中で行われる `` pyramid.request.Request``と `` pyramid.response.Response``の陰影のあるmonkeypatchingを取り除きましょう。 Webobはもはやこれが行われていることに依存しません。代わりに、Pyramid RequestクラスのResponseClass属性がPyramid応答クラスに割り当てられます。これでWebObを満たし、以前と同じようにMonkeypatchingで動作します。

1.4a3(2012-10-26)

バグの修正

  • match_param述部のtextメソッドは、値をソートするために修正されました。 https://github.com/Pylons/pyramid/pull/705の一部
  • 1.4a `` pyramid.scripting.prepare``は、同じ名前の1.3系列関数とは異なる動作をします。特に、リクエストを渡すと、1.3のようにリクエストの `` registry``属性を設定しません。症状は、 `` registry``属性を持たない `` pyramid.paster.bootstrap``(関数を使用する)へのリクエストを渡すと、レジストリがPyramidのリクエストに添付されることが想定されます。この仮定は、1.3では可能であるが、1.4では可能ではない。前提は1.4でも可能です(レジストリがブートストラップに渡されたリクエストに添付されているか準備中です)。
  • マクロ名を持つカメレオンZPTレンダラに名前を付けたビュー設定(例えば、 `` renderer = &#39;some / template#somemacro.pt``など)とそのビュー内のマクロ名のないビュー設定を登録するとき同じテンプレート(例えば、 `` renderer = &#39;some / template.pt&#39;``)を使うと、内部キャッシングは2つを混乱させる可能性があり、あなたのコードはもう一方の代わりにレンダリングされる可能性があります。

特徴

  • `` request_param``のview / route述部に複数の値をシーケンスとして指定できるようにします。以前は、単一の文字列値のみが許可されていました。 https://github.com/Pylons/pyramid/pull/705を参照してください。
  • 足場の `` .ini``ファイルに置かれたドキュメンテーションセクションへの参照に関するコメント。
  • `` pyramid.authentication.BasicAuthAuthenticationPolicy``にHTTP基本認証ポリシーを追加しました。
  • コンフィギュレータ `` testing_securitypolicy``メソッドは、作成したポリシーオブジェクトを返します。
  • コンフィギュレータ `` testing_securitypolicy``メソッドは、 `` remember_result``と `` forget_result``という2つの新しい引数を受け取ります。これらの値が指定された場合、ポリシーの `` remember``メソッドと `` forget``メソッドの結果にそれぞれ影響します。
  • `` testing_securitypolicy``によって作成されたDummySecurityPolicyは、 `` forget``メソッドが呼び出されたときにポリシーに ``忘れられた ``値( `` True``値)を設定するようになりました。
  • `` testing_securitypolicy``で作成されたDummySecurityPolicyは、 `` remember``メソッドが呼び出されたときに呼び出される `` principal``引数の値である `` remembered``値をポリシーに設定するようになりました。
  • 新しい `` physical_path``ビュー述語。指定する場合、この値は、この述部が真と一致するためにトラバーサルによって検出されたコンテキストの物理的なトラバーサルパスを表す文字列またはタプルでなければなりません。例: `` physical_path = &#39;/&#39; ``または `` physical_path = &#39;/ a / b / c``または `` physical_path =(&#39; &#39;、&#39; a &#39;、&#39; b &#39;、&#39; c &#39;) `` 。これはパス接頭辞の一致または正規表現ではなく、パス全体の一致です。これは、あるオブジェクトがトラバースされているときに常にビューを表示したいときに便利ですが、どのようなオブジェクトであるかを確かめることができないので、 `` context``述語を使うことはできません。スラッシュ文字またはタプル要素の間の個々のパス要素は、リソース名のUnicode表現である必要があります。

1.4a2(2012-09-27)

バグの修正

  • アセット仕様のMako defnamesとChameleonマクロ名を調べようとするとき、ファイル名にハイフンが含まれている可能性があることを考慮してください。 https://github.com/Pylons/pyramid/pull/692を参照してください。

特徴

  • 新しい `` pyramid.session.check_csrf_token``という便利な関数が追加されました。
  • `` check_csrf``ビュー述語が追加されました。たとえば、 `` config.add_view(someview、check_csrf = True) ``を実行することができます。述語がチェックされると、 `` request.params``の `` csrf_token``の値がリクエストのセッションのCSRFトークンと一致すると、ビューは実行が許可されます。そうしないと、実行が許可されません。
  • alchemyテンプレートに `` Base.metadata.bind = engine``を追加して、必要に応じて定義されたテーブルが機能するようにしてください。

ドキュメンテーション

  • `` Base.metadata.bind = engine``を錬金術足場に挿入した後に必要な変更を加えて、wiki2 SQLAチュートリアルを更新してください。

1.4a1(2012-09-16)

バグの修正

  • 1.3のブランチからのフォワードポート:認証ポリシーが設定されていないとき、 `` pyramid.security.effective_principals``の呼び出しは無条件に空のリストを返します。これは間違っていたので、無条件に `` [Everyone] ``を返さなければなりませんでした。
  • 明示的なurlディスパッチ正規表現にはコロンが含まれるようになりました。 https://github.com/Pylons/pyramid/issues/629
  • Python 3.2で少なくとも1つの64ビットUbuntuシステムで、 `` view_config``デコレータを使用すると、 `` RuntimeError:辞書はイタレーションの間にサイズが変更されました.``例外が発生しました。それはもはやありません。詳細については、https://github.com/Pylons/pyramid/issues/635を参照してください。
  • Mako Templatesルックアップで、URIがすでに調整されているかどうかを確認し、資産仕様に戻します。通常、継承されたテンプレートまたはインクルードされたコンポーネントで発生します。 https://github.com/Pylons/pyramid/issues/606 https://github.com/Pylons/pyramid/issues/607
  • Mako Templatesルックアップでは、継承をアセット仕様と混合するときに、絶対URI(makoディレクトリを使用)をチェックします。 https://github.com/Pylons/pyramid/issues/662
  • HTTP Acceptヘッダーが正規化されていないため、競合するビューの登録が見逃される可能性があります。大文字と小文字が異なる2つのビュー( &#39;text / html&#39;対 &#39;text / HTML&#39;)はエラーになります。 https://github.com/Pylons/pyramid/pull/620
  • Python 3で動作するPyramidアプリケーションで複数のビューを `` accept``述語で登録すると、 `` TypeError:unorderable types:function()&lt;function() ``例外を受け取った可能性があります。

特徴

  • Python 3.3との互換性。

  • Configurator.add_directiveは、部分名や `` __call__``を実装しているオブジェクトのような任意の呼び出し可能ファイルを受け付け、 `` __name__``や `` __doc__``属性を持たないようになりました。 https://github.com/Pylons/pyramid/issues/621およびhttps://github.com/Pylons/pyramid/pull/647を参照してください。

  • `` pyramid.config.Configurator.add_view_predicate``、 `` pyramid.config.Configurator.add_route_predicate``、および `` pyramid.config &#39;&#39;を介して、ビュー作成者が使用するサードパーティのカスタムビュー、ルート、サブスクライバ述語を追加できるようになりました。 .Configurator.add_subscriber_predicate``。たとえば、これを行う:

    config.add_view_predicate('abc', my.package.ABCPredicate)
    

    ビュー作成者は、その述部を構成したアプリケーションでこれを行うことができます。

    @view_config(abc=1)
    

    `` add_route``と `` add_subscriber``にも同様の機能があります。詳細については、「フック」の章の「サードパーティのビュー、ルート、またはサブスクライバ述語の追加」を参照してください。

    上記の機能をサポートするために加えられた変更は、同じ&quot;注文&quot;を使用して登録されたアクションだけが互いに競合する可能性があることに注意してください。以前は、異なる注文で登録された行動が衝突する可能性がありましたが、私の知る限り、この行動には何も依存していませんでした(それはちょっとばかげていました)。

  • オブジェクトのクラスに対して `` __json__``メソッドを定義することで、カスタムオブジェクトをPyramidで簡単にJSON直列化可能にすることができます。このメソッドは、 `` json.dumps``(int、リスト、辞書、文字列など)によってネイティブにシリアライズ可能な値を返さなければなりません。

  • JSONレンダラーでは、未知のオブジェクトをJSONシリアライズに変換するカスタムタイプアダプタの定義が可能になりました。

  • 今回のリリースでは、 `` request_method``述部は、 `` GET``を使用するときに `` HEAD``が暗示されていることを意味します。例えば、 `` @view_config(request_method = &#39;GET&#39;) ``を使うことは `` @view_config(request_method =( &#39;GET&#39;、 &#39;HEAD&#39;)) ``を使うのと同じです。 @view_config(request_method =( &#39;GET&#39;、 &#39;POST&#39;) ``は、 `` @view_config(request_method =( &#39;GET&#39;、 &#39;HEAD&#39;、 &#39;POST&#39;) ``を使うのと同じです。はボディを省略したGETの変種で、WebObはHEADが使用されたときに空のボディを返す特別なサポートを持っています。

  • `` config.add_request_method``は任意の呼び出し可能な要求オブジェクトの拡張をサポートするために導入されました。このメソッドは、以前の `` config.set_request_property``を拡張し、メソッドとプロパティをサポートします。この方法では、バージョン1.3での `` config.set_request_property``よりも要求生成時に実行されるコードが少なくなりました。

  • `` query``引数が指定されていても空であれば `` request.resource_url``で生成されたURLに ````を加えないでください。

  • `` _query``引数が指定されていても空であれば `` request.route_url``で生成されたURLに ````を加えないでください。

  • 静的ビューマシンは、 `` HTTPNotFound``と `` HTTPMovedPermanently``の例外を発生させます(戻り値ではなく)。これはNot Found View(および他の例外ビュー)によって捕捉される可能性があります。

  • Makoレンダラは現在、資産仕様のdef名をサポートしています。 def名がアセット仕様にある場合、システムはテンプレート内でテンプレートdefをレンダリングし、結果を返します。資産仕様の例は `` package:path / to / template#defname.mako``です。これはテンプレート全体をレンダリングするのではなく、 `` template.mako``テンプレートの中で `` defname``という名前のdefをレンダリングします。ビューから ``( &#39;defname&#39;、{}) ``の形でタプルを返す古い方法は、下位互換性のためにサポートされています。

  • Chameleon ZPTレンダラはアセット仕様でマクロ名を受け入れるようになりました。アセット仕様にマクロ名がある場合、システムは `` define-macro``としてリストされたマクロをレンダリングし、テンプレート全体をレンダリングする代わりに結果を返します。資産仕様の例: `` package:path / to / template#macroname.pt``。これは、templae全体ではなく、 `` template.pt``テンプレート内で `` macroname``として定義されたマクロをレンダリングします。

  • 述部の不一致例外がある場合(述部が機能しないためにビューが特定の要求に一致しない場合に表示されます)、例外には一致しなかった述部のテキスト記述が含まれるようになりました。

  • Configuratorに `` add_permission``指示メソッドが追加されました。この指令は、ピラミッドのイントロスペクションシステムにイントロスペクト可能な自立型パーミッションを登録します。 Pyramidの上に構築されたフレームワークは、 `` permissions``のイントロスペクション可能なカテゴリデータを使用して、実行中のシステムでサポートされているパーミッションの包括的なリストを構築することができます。このメソッドが追加される前に、権限は `` add_view``呼び出しで名前を付ける副作用としてこのイントロスペクティブカテゴリに既に登録されていました。このメソッドは、アクセス権を `` permissions``に入れることを可能にします。関連するビューと共に名前を付けることなく、「イントロスペクティブなカテゴリ」を作成します。 `` add_permission``の使用例を次に示します:

    config = Configurator()
    config.add_permission('view')
    
  • `` UnencryptedCookieSessionFactoryConfig``は、セッションがマーシャリングされる方法に影響を与えるために使われる `` signed_serialize``と `` signed_deserialize``フックを受け付けるようになりました(デフォルトでHMAC + pickleで行われます)。

  • `` pyramid.testing.DummyRequest``は、 `` set_property``のような `` pyramid.util.InstancePropertyMixin``クラスによって提供されるメソッドをサポートするようになりました。

  • `` config.set_request_property``または `` config.add_request_method``を介して追加されたリクエストプロパティとメソッドはtweensで利用できるようになりました。

  • `` config.set_request_property``または `` config.add_request_method``で追加されたリクエストプロパティとメソッドは、 `` pyramid.paster.bootstrap``から返されたリクエストオブジェクトで利用可能になりました。

  • `` bootstrap``中の環境要求の `` request.context``は、提供された要求にコンテキストがまだ設定されていない場合、ルートオブジェクトになりました。

  • `` pyramid.decorator.reify``関数はAPIになり、APIドキュメントに追加されました。

  • `` testing.testConfig(...): ``などのテストでコンフィギュレータを生成するために使用できる `` pyramid.testing.testConfig``コンテキストマネージャを追加しました。

  • ユーザーは、新しい `` request.invoke_subrequest`` APIを使用して、ビューコード内からサブリクエストを呼び出すことができます。

廃止

  • `` pyramid.config.Configurator.set_request_property``はドキュメント化されていません。このメソッドは使用可能ですが、より機能的な `` pyramid.config.Configurator.add_request_method``を代わりに使用する必要があります(すべて同じ機能を持ちますが、メソッドでリクエストオブジェクトを拡張することもできます)。

後方の非互換性

  • ピラミッドルータは、 `` bfg.routes.route``または `` bfg.routes.matchdict``の値をリクエストのWSGI環境辞書に追加しなくなりました。これらの値は `` repoze.bfg`` 1.0で文書廃止されました(事実上7つのマイナーリリース前)。コードがこれらの値に依存している場合は、代わりにrequest.matched_routeとrequest.matchdictを使用してください。
  • environ辞書を `` pyramid.traversal.ResourceTreeTraverser .__ call__``(別名 `` ModelGraphTraverser .__ call__``)に直接渡すことはもはや不可能です。代わりに、要求オブジェクトを渡す必要があります。リクエストの代わりに環境を渡すと、Pyramid 1.1以降の廃止予定の警告が生成されました。
  • `` webob.request.LegacyRequest``を要求ファクトリとして使用すると、Pyramidは正しく動作しなくなります。 LegacyRequestクラスのインスタンスには、文字列を返す `` request.path_info``があります。このPyramidのリリースでは、 `` request.path_info``が無条件にUnicodeになると仮定しています。
  • `` get_renderer``、 `` get_template``、 `` render_template``、および `` render_template_to_response``という名前の `` pyramid.chameleon_zpt``と `` pyramid.chameleon_text``の関数は削除されました。これらはPyramid 1.0以降のインポート時に廃止予定の警告を出しました。 pyramid.renderers.get_renderer()。implementation() ``、 `` pyramid.renderers.render() ``または `` pyramid.renderers.render_to_response``を使用してください。これらの機能の代わりにそれぞれ機能します。
  • `` pyramid.configuration``モジュールが削除されました。 Pyramid 1.0以降、非推奨となっていたため、使用時に非推奨警告が表示されました。代わりに `` pyramid.config``を使用してください。
  • `` pyramid.paster.PyramidTemplate`` APIが削除されました。ピラミッド1.1以来廃止され、輸入に関する警告が出されました。あなたのコードがこれに依存している場合は、代わりに `` pyramid.scaffolds.PyramidTemplate``をインポートするようにコードを調整してください。
  • `` pyramid.settings.get_settings() `` APIが削除されました。 Pyramid 1.0以降、廃止予定の警告が表示されていました。あなたのコードがこのAPIに依存している場合、代わりに `` pyramid.threadlocal.get_current_registry()。settings``を使うか、リクエストから利用可能なレジストリの `` settings``属性を使います( `` request.registry.settings``) 。
  • `` pyramid.testing``モジュールのこれらのAPIは削除されました。彼らはPyramid 1.0以降、廃止予定の警告を印刷しています:
    • `` registerDummySecurityPolicy``は、代わりに `` pyramid.config.Configurator.testing_securitypolicy``を使います。
    • `` registerResources``(別名 `` registerModels``、代わりに `` pyramid.config.Configurator.testing_resources``)を使います。
    • `` registerEventListener``では、代わりに `` pyramid.config.Configurator.testing_add_subscriber``を使います。
    • `` registerTemplateRenderer``(別名 registerDummyRenderer`)では、代わりに` `pyramid.config.Configurator.testing_add_template``を使います。
    • `` registerView``では、代わりに `` pyramid.config.Configurator.add_view``を使います。
    • `` registerUtility``では、代わりに `` pyramid.config.Configurator.registry.registerUtility``を使います。
    • `` registerAdapter``では、代わりに `` pyramid.config.Configurator.registry.registerAdapter``を使います。
    • `` registerSubscriber``では、代わりに `` pyramid.config.Configurator.add_subscriber``を使います。
    • `` registerRoute``では、代わりに `` pyramid.config.Configurator.add_route``を使います。
    • `` registerSettings``は代わりに `` pyramid.config.Configurator.add_settings``を使います。
  • Pyramid 1.3以前では、終了したコールバックが実行される前に、Responseオブジェクトの `` __call__``メソッドが呼び出されました。このリリースから、Responseオブジェクトの `` __call__``メソッドは、終了したコールバックが実行された後に呼び出されます。これは `` request.invoke_subrequest``機能をサポートしています。
  • `` pyramid.httpexceptions`の `` HTTPCreated```、 `` HTTPAccepted``、 `` HTTPNonAuthoritativeInformation``、 `` HTTPNoContent``、 `` HTTPResetContent``、 `` HTTPPartialContent``の200シリーズ例外レスポンスは、 `` HTTPOk``から継承しなくなりました。代わりに、 `` HTTPSuccessful``という名前の新しい基本クラスを継承します。これは、 `` HTTPOk``の例外ビューを登録して、例外ビューが上記のすべての例外をキャッチすることを期待しない限り、あなたには何の影響も与えません。

ドキュメンテーション

  • 物語のドキュメンテーションに「ピラミッドのアップグレード」の章を追加しました。 Pyramid APIの廃止と削除に対処する方法と、テストの実行中およびサーバーの実行中にPyramidで生成された廃止予定の警告を表示する方法について説明します。
  • ドキュメントに「サブリクエストを呼び出す」という章が追加されました。新しい `` request.invoke_subrequest`` APIの使い方について説明しています。

依存関係

  • PyramidにはWebOb 1.2b3 +が必要です(以前のPyramidリリースは1.2dev +のみに依存していました)。これは、 `` request.path_info``をテキストとして返すWebObのバージョンを確実に取得するためです。

1.3(2012-03-21)

バグの修正

  • `` pyramid.wsgi.wsgiapp2``がダウンストリームのWSGIアプリケーションを呼び出すと、アプリケーションのenvironは `` bfg.routes.matchdict``や `` bfg.routes.route``のキーをもはや持っていません。それ。このバグの症状は、 `` wsgiapp2``でラップされたピラミッドアプリで、間違った視点を見つけることになります。
  • https://github.com/Pylons/pyramid/issues/461という問題(インスタンスメソッドをビュー呼び出し可能オブジェクトとして使用できるようにした)の修正により、リクエスト引数のみを宣言したメソッドが使用された場合、後方互換性が導入されました。 https://github.com/Pylons/pyramid/issues/503を参照してください。

1.3b3(2012-03-17)

バグの修正

  • `` config.add_view( <aninstancemethod> ) ``は、 `` __text__``を含むAttributeErrorを発生させました。 https://github.com/Pylons/pyramid/issues/461を参照してください。
  • すべてのPyramid提供の `` .ini``ファイルで、何もしない `` pyramid.debug_templates``設定への参照を削除してください。この設定は、以前より優れた例外を表示するようにChameleonに伝えました。現在、Chameleonはこの設定の値に関係なく常に素晴らしい例外をレンダリングします。

足場

  • `` alchemy``スキャフォールドは、プロジェクトを作成している人が初期化スクリプトを実行することを忘れた場合、ブラウザに有益なエラーメッセージを表示するようになりました。
  • `` alchemy`` scaffold初期化スクリプトは `` initialize_ <projectname> `` populate_の代わりに_db``を使用します<projectname> ``

ドキュメンテーション

  • Wikiチュートリアルは、PyCon US 2012スプリントでのコラボレーションにより改善されました。

1.3b2(2012-03-02)

バグの修正

  • メソッド `` pyramid.request.Request.partial_application_url``はAPIドキュメントにはもうありません。それは私的な方法であることを意図していた。 APIメソッドとしてのドキュメンテーションへの公開は間違いであり、プライベートなものに変更されました。

  • 静的ビューがWindows上の絶対ファイルシステムパスを使用して登録されたとき、 `` request.static_url``関数はそのリソースへのURLを生成するようには機能しませんでした。症状:&quot;スタティックなURL定義がありませんc:\ foo \ bar \ baz &quot;

  • すべてのテストをWindows XPに合格させる。

  • Python 3でのACL認証チェックのバグ: `` pyramid.authorization.ACLAuthenticationPolicy``の `` permits``と `` principals_allowed_by_permission``メソッドは、ACLに対するパーミッションがそして、ACL許可文字列が関数に渡された `` permission``値の部分文字列だった場合のみです。

    このバグはPython 2ではPyramidの展開に影響しません。 Python 3で動作するデプロイメントにのみ存在するバグです。これはPyramid 1.3a1以来存在していました。

    このバグは、Python 3の下の文字列に `` __iter__``属性が存在し、Python 2の文字列の下に存在しないためです。

1.3b1(2012-02-26)

バグの修正

  • Configuratorが古いスタイルの `` pyramid.configuration.Configurator``インスタンスだった場合、 `` pyramid.config.Configurator.with_package``は機能しませんでした。
  • ピラミッド認可ポリシーはイントロスペクサーに表示されませんでした。

廃止

  • `` tmpl_context``要求変数へのすべての参照は、ドキュメントから削除されました。ピラミッドに存在することは、決してPylonsユーザーではない人々にとって混乱を招いています。それはPyramid 1.0のPylonsユーザーのための移植の便宜のために追加されましたが、PyramidレンダリングシステムがPylonsのものとは大きく異なり、Pylonsで提供するように設計された方法を実行するための方法があります。それは&quot;永遠に&quot;存在し続けるでしょうが、それはドキュメントで推奨されたり言及されません。

1.3a9(2012-02-22)

特徴

  • Configuratorコンストラクタに `` introspection``ブール値を追加してください。これが `` True``の場合、コンフィギュレータで登録されたアクションはイントロスペクサーに登録されます。それが「偽」であれば、そうではないでしょう。デフォルトは `` True``です。アクションの処理中に `` False``に設定すると、後続の登録文に対するイントロスペクションが防止され、 `` True``に設定することでそれらを再び起動します。この追加は、デバッグツールバーのビューとメソッドがイントロスペクサーに表示されないという要件に対応するためのものです。
  • 新しいAPI: `` pyramid.config.Configurator.add_notfound_view``。これは `` pyramid.Config.configurator.add_view``のラッパーで、簡単なappend_slashサポートを提供し、権限について正しいことを行います。これまで推奨されていた `` context = HTTPNotFound``で直接 `` add_view``を呼び出すのが好ましいでしょう。
  • 新しいAPI: `` pyramid.view.notfound_view_config``。これは、スキャン時に `` pyramid.config.Configurator.add_notfound_view``を呼び出す `` pyramid.view.view_config``のようなデコレータコンストラクタです。前に推奨したように、 `` pyramid.view.view_config``を `` context = HTTPNotFound``で使うのが好ましいでしょう。
  • 新しいAPI: `` pyramid.config.Configurator.add_forbidden_​​view``これは、アクセス許可について正しいことをする `` pyramid.Config.configurator.add_view``のラッパーです。これまで推奨されていた `` context = HTTPForbidden``で直接 `` add_view``を呼び出すのが望ましいでしょう。
  • 新しいAPI: `` pyramid.view.forbidden_​​view_config``。これは、スキャン時に `` pyramid.config.Configurator.add_forbidden_​​view``を呼び出す `` pyramid.view.view_config``のようなデコレータコンストラクタです。これまで推奨されていたように `` pyramid.view.view_config``を `` context = HTTPForbidden``で使うのが好ましいでしょう。
  • 新しいAPI: `` pyramid.response.FileResponse``と `` pyramid.response.FileIter``は、手動でファイルを提供しなければならないビューで使用するためのものです。

後方の非互換性

  • `` pyramid.config.Configurator.with_context``クラスメソッドを削除してください。これは決してAPIではなく、 `` pyramid_zcml``だけで使用され、その機能はそのパッケージの最新リリースに移されました。つまり、Pyramidのこのリリースでは0.9.2以降のリリースの `` pyramid_zcml``を使う必要があります。
  • `` pyramid.config.Configurator``コンストラクタAPIの `` introspector``引数は削除されました。ブール型の &quot;イントロスペクション&quot;フラグで置き換えられました。
  • `` pyramid.registry.noop_introspector`` APIオブジェクトは削除されました。
  • 廃止予定の `` set_notfound_view``コンフィグレータメソッドは、新しい `` add_notfound_view``コンフィグレータメソッドのエイリアスになりました。同様に、廃止予定の `` set_forbidden_​​view``は新しい `` add_forbidden_​​view``のエイリアスになりました。 `` set_notfound_view``または `` set_forbidden_​​view``を介して登録された ``(コンテキスト、リクエスト) ``コールシグネチャでビューに送られた `` context``は次のような例外オブジェクトになりました。実際のリソースコンテキストが見つかりました。実際のリソースコンテキストを取得するには `` request.context``を使います。また、 `` set_notfound_view``を `` add_notfound_view``に向けて廃止し、エイリアシングにもかかわらず `` add_forbidden_​​view``を優先して `` set_forbidden_​​view``を廃止することもお勧めします。

廃止

  • `` pyramid.view.append_slash_notfound_view``と `` pyramid.view.AppendSlashNotFoundViewFactory``のAPIドキュメントが削除されました。これらの名前はまだ存在し、インポート可能ですが、もはやAPIではありません。同じ動作をするには、 `` pyramid.config.Configurator.add_notfound_view(append_slash = True) ``または `` pyramid.view.notfound_view_config(append_slash = True) ``を使用します。
  • コンフィギュレータの `` set_forbidden_​​view``メソッドと `` set_notfound_view``メソッドはドキュメントから削除されました。彼らはPyramid 1.1以来非難されています。

バグの修正

  • `` config.add_static_view``で使用される静的ファイルレスポンスオブジェクトは静的ファイルを2回開きました。
  • AppendSlashNotFoundViewFactoryはrouteを一致させるためにrequest.pathを使用しました。これは間違っていました。なぜなら、request.pathにはスクリプト名が含まれているため、スクリプト名が空でない状況では失敗することになります。それはrequest.path_infoを使用しているはずです。

ドキュメンテーション

  • `` add_view``や `` view_config``を使ってビューを登録する際の説明を、 `` add_notfound_view``や `` add_notfound_view``を使って説明したものに置き換えて、&quot;フックnotfound_view_config``を実行します。
  • `` add_forbidden_​​view``や `` add_forbidden_​​view``を使ってビューを登録する際の説明を、 `` add_view``や `` view_config``を使って登録する説明を置き換えることで、&quot;Hooks &quot;章の&quot;禁止されていないビューを作成するforbidden_​​view_config``です。
  • `` add_view``や `` view_config``を使ったビューの登録の説明を `` add_notfound_view``や `` add_notfound_view``を使ったものに置き換えて、&quot;URL Dispatch &quot;章の&quot;Slash-Appended Routesへのリダイレクト&quot; `` notfound_view_config``
  • すべてのチュートリアルで、 `` pyramid.view.view_config``ではなく、 `` pyramid.view.forbidden_​​view_config``をHTTPForbiddenコンテキストで使用するように更新しました。

1.3a8(2012-02-19)

特徴

  • `` Configurator``の `` scan``メソッドは、 `` ignore``引数を渡すことができます。これは、文字列、呼び出し可能な文字列、文字列や呼び出し可能なものからなるリストです。この機能を使用すると、サブモジュール、サブパッケージ、およびグローバルオブジェクトのスキャンが許可されます。 `` scan``に `` ignore``引数を使う方法の詳細については、http://readthedocs.org/docs/venusian/en/latest/#ignore-scan-argumentを参照してください。
  • ビュー呼び出し可能関数が応答に変換できない値を返すとき(たとえば、ビュー呼び出し可能関数がレンダラーが定義されていないディクショナリを返すか、まったく値を返さないなど)、エラーメッセージが改善されます。エラーメッセージには、ビュー呼び出し可能なものに関する情報と呼び出し結果が含まれるようになりました。
  • .pycのみのモジュールが `` config.include``されたときのエラーメッセージが改善されました。これは、エラー報告要件のために許可されていません。試行されると、より良いエラーメッセージが表示されます。以前は、&quot;AttributeError: &#39;NoneType&#39;オブジェクトに属性 &#39;rfind&#39; &quot;がありません。
  • `` pyramid.config.Configurator.add_traverser`` APIメソッドを追加してください。詳細については、 &quot;Traverserの変更&quot;というタイトルのHooks Narrativeドキュメンテーションセクションを参照してください。これは新機能ではなく、ZCA APIを使用することなくトラバーサを追加するためのAPIを提供するだけです。
  • `` pyramid.config.Configurator.add_resource_url_adapter`` APIメソッドを追加してください。詳細については、&quot;pyramid.request.Request.resource_urlのURLの生成方法の変更&quot;というフックの説明文章のセクションを参照してください。これは新しい機能ではなく、ZCA APIを使用せずにリソースURLアダプタを追加するためのAPIを提供するだけです。
  • システム値 `` req``が `` request``のエイリアスとしてレンダラーに供給されるようになりました。これは、例えば、テンプレート内で、 `` request.route_url(...) ``の代わりに `` req.route_url(...) を実行できることを意味します。これは、テンプレート内から要求メソッドと属性を使用するのに必要な型付け量を減らすための変更です。値 ` request``も引き続き利用できますが、これは単なる選択肢です。
  • 新しいインターフェースが追加されました: `` pyramid.interfaces.IResourceURL``。 `` request.resource_url``が呼び出されると、そのインタフェースを実装するアダプタを使ってリソースURLの生成を無効にすることができます。このインタフェースは、現在廃止されている `` pyramid.interfaces.IContextURL``インタフェースを置き換えます。
  • リソースの `` __resource_url__``メソッド(リソース&quot;章の&quot;リソースURL生成のオーバーライド &quot;を参照)に渡された辞書は、` 要求中に生成されたアプリケーションURLを表す app_url``キーを含んでいます.resource_url``です。これは潜在的にカスタマイズされたURLプレフィックスを表し、ユーザーが ` request.resource_url``に渡す可能性のあるカスタムスキーム、ホスト、ポート情報を含みます。必要に応じて `` request.application_url``の代わりに使用してください。
  • `` request.resource_url`` APIは `` app_url``、 `` scheme``、 `` host``、 `` port``の引数を受け付けます。 app_url引数を使用して、URLの生成時にURL接頭辞を置き換えることができます。 `` scheme``、 `` host``、 `` port``の引数は、 `` request.application_url``のデフォルト値を部分的に置き換えるために使うことができます。
  • `` request.resource_path``という名前の新しいAPIが存在します。 `` request.resource_url``のように動作しますが、絶対URLではなく相対URLを生成します。
  • `` request.route_url`` APIは、 `` _app_url``、 `` _scheme``、 `` _host``、 `` _port``の引数を受け付けるようになりました。 `` _app_url``引数は、URLの生成時にURL接頭辞を置換するために使用できます。 `` _scheme``、 `` _host``、 `` _port``の引数を使って、 `` request.application_url``のデフォルト値を部分的に置き換えることができます。

後方の非互換性

  • `` pyramid.interfaces.IContextURL``インタフェースは非推奨です。人々はこれを使用して、&quot;Hooks &quot;章にリソースURLアダプタを登録して、Pyramid 1.0以来カスタムトラバーサを介して見つかったリソースの `` request.resource_url`` URL生成に影響を与えるように指示しました。

    インターフェイスはまだ存在していますが、そのようなアダプタを登録しても機能しますが、Pyramidの主要なリリースの後にこのインターフェイスはソフトウェアから削除されます。新しい `` pyramid.config.Configurator.add_resource_url_adapter`` APIを使用して登録した同等の `` pyramid.interfaces.IResourceURL``アダプタに置き換える必要があります。 `` request.resource_url``が呼び出されたときに `` pyramid.interfaces.IContextURL``アダプタが見つかると、廃止予定の警告が出されるようになりました。

ドキュメンテーション

  • SQLA Wikiチュートリアルで `` session``インスタンスを作成せず、代わりに未加工の `` DBSession``を使用してください(これは実際のSQLAアプリケーションでより一般的です)。

足場

  • `` pyramid.includes``ターゲットを足場のiniファイルに別々の行に入れて、ツールバーを無効にしたいときに `` pyramid_debugtoolbar``行だけをコメントアウトするように伝えることができます。

依存関係

  • `` venusian`` = 1.0a3に依存して、スキャンの ``無視 &#39;`のサポートを提供してください。

内部

  • カスタマイズ可能な設定のキープレフィックスを提供する&quot;MakoRendererFactoryHelper &quot;を作成します。 &quot;mako。&quot;以外の設定プレフィックスを使用して、グローバルmako設定を使用しない異なる工場を作成できるようにします。これはデバッグツールバーに便利です。デバッグツールバーは、カスタムmako設定を使用している人が現在妨害している可能性があります。

1.3a7(2012-02-07)

特徴

  • `` config.include``が `` includeme``を見つけることができないとき、より有益なエラーメッセージです。 https://github.com/Pylons/pyramid/pull/392を参照してください。
  • 内部:解読不能なdiscriminatorsを早期に捕捉する(resolveConflictsへの道を見つけるのではなく、エラーを起こす)。
  • `match_param`ビュー述語は、文字列またはタプルを受け入れるようになりました。これは、dictを受け入れるという壊れた振る舞いを置き換えます。詳細については、https://github.com/Pylons/pyramid/issues/425を参照してください。

バグの修正

  • `` development.ini``ファイル(または使用中の他の.iniファイル)が変更されたときに、 `` --reload``フラグとともに `` pserve``が使用されると、プロセスが再開します。 https://github.com/Pylons/pyramid/issues/377およびhttps://github.com/Pylons/pyramid/pull/411を参照してください。
  • `` prequest``スクリプトは、HTMLやテキストを返さなかったURLに対して使用すると失敗します。 https://github.com/Pylons/pyramid/issues/381を参照してください。

後方の非互換性

  • `match_param`ビュー述語は、もはやdictを受け付けません。これは、dictベースの引数の実装が壊れているため、悪影響はありません。

ドキュメンテーション

  • 物語のドキュメントにトラバーサルな世界の例を追加してください。

1.3a6(2012-01-20)

特徴

  • 新しいAPI: `` pyramid.config.Configurator.set_request_property``。リクエストファクトリを変更せずに、リクエストに遅延プロパティー記述子を追加します。このメソッドは競合検出を提供し、要求にプロパティを追加するための推奨される方法です。
  • Pyramidの `` static_view``によって生成された応答は、 `` wsgi.file_wrapper``を使用します(http://www.python.org/dev/peps/pep-0333/#optional-platform-specific-file-handlingを参照) Webサーバーから提供されたものです。

バグの修正

  • `` accept``で登録されたビューは、同じ述語引数を持つ別のビューでは、正しく上書きすることができませんでした。詳細については、https://github.com/Pylons/pyramid/pull/404を参照してください。
  • `` view_defaults``デコレータを持つクラスを指している `` Configurator.add_view``への `` view``引数に点線の名前を使用すると、ビューのデフォルトは適用されません。 https://github.com/Pylons/pyramid/issues/396を参照してください。
  • 静的なURLパスは2回URL引用されました。 https://github.com/Pylons/pyramid/issues/407を参照してください。

1.3a5(2012-01-09)

バグの修正

  • `` pyramid.view.view_defaults``デコレータは、複数のビューがコンフィグレーションの競合解決のために異なるデフォルトに依存している場合、正しく動作しませんでした。 https://github.com/Pylons/pyramid/issues/394を参照してください。

後方の非互換性

  • `` path_info``ルートとビューの述語は、 `` request.path_info``(Python 3とPython 2に基づく不定値)ではなく、 `` request.upath_info``(Unicode)と一致するようになりました。これは、Python 2とPython 3のマッチングを正規化するために行う必要があります。

1.3a4(2012-01-05)

特徴

  • 新しいAPI: `` pyramid.request.Request.set_property``。リクエストファクトリを変更せずに、リクエストに遅延プロパティー記述子を追加します。新しいプロパティが再定義され、インスタンスの存続期間中の値を効果的にキャッシュすることができます。このための一般的な使用例は、要求に対するデータベース接続を取得するか、または現在のユーザーを識別することです。
  • スカイフォールディングで `` wsgiref``の代わりに `` waitress`` WSGIサーバを使用してください。

バグの修正

  • `` pyramid.events.subscriber``のドキュメントは、このような引数を持たないデコレータとして使うことを示しています:

    @subscriber()
    def somefunc(event):
        pass
    

    レジストリを介して送信されたすべてのイベントを受け取るために `` somefunc``を登録しますが、これは間違いです。代わりに、イベントをまったく受け取りません。これは修正され、コードはドキュメントと一致します。 https://github.com/Pylons/pyramid/issues/386も参照してください。

  • `` route_url``や `` route_path``がURLやパスを生成するために使われたとき、ルートパターンの文字部分はURL引用符で囲まれませんでした。

  • `` route_path``または `` route_url``の結果は、入力に応じて `` unicode``または `` str``でした。これは常に `` str``であることが保証されています。

  • リテラル部分にASCII以外の文字が含まれているパターンが不確定であった場合のURLマッチング。 `` add_route``に与えられるパターンは、 `` unicode``値、またはASCII文字のみを含む `` str``値のいずれかとみなされます。高次の文字が含まれているURLからパス情報を照合する場合は、パターン内のデコードされたパス部分のUnicode表現を渡すことができます。

  • `` traverse = ``ルート述語を使うとき、トラバーサルパターンや一致するダイナミックセグメントに高次の文字があれば、トラバーサルはURLDecodeErrorで失敗します。

  • ::のようなルートパターンで `` traverse``という名前の動的セグメントを使用しています:

    config.add_route('trav_route', 'traversal/{traverse:.*}')
    

    ルートが一致し、URLの一致部分に高次の文字が含まれていた場合に `` UnicodeDecodeError``が発生します。 https://github.com/Pylons/pyramid/issues/385を参照してください。

  • ルートパターンで `` * traverse`` starargを使うと、名前に `` @@ ``を持つURL(ビュー名を表す)がトラバース中にトラバーサル機構によって不適切に引用され、ビューが正しく見つかりません。 https://github.com/Pylons/pyramid/issues/382およびhttps://github.com/Pylons/pyramid/issues/375を参照してください。

後方の非互換性

  • `` route_url``または `` route_path``に渡された文字列値は&quot;remainder &quot;に置き換えられ、埋め込まれたスラッシュを除いてURLクォートされます。例えば::

    config.add_route('remain', '/foo*remainder')
    request.route_path('remain', remainder='abc / def')
    # -> '/foo/abc%20/%20def'
    

    以前は、残りの置換文字として渡された文字列の値は、URLクォートを付けずに変更されませんでした。しかし、渡される値がUnicode(生のUnicodeはURLまたはパスに配置することはできません)であり、値が文字列であれば残りのURL生成機構と矛盾します(これは &#39;呼び出し側が指定しない限り引用符で囲まないでください)。

    いくつかの人々は、クエリ文字列要素とURLの部分を固定するために古い動作に頼っているでしょう。申し訳ありませんが、これを行うには、 `` _query``や `` _anchor``引数を `` route_path``または `` route_url``に使用するようにコードを変更する必要があります。

  • 非ASCII文字を含むバイト文字列をパターンとして `` add_route``に渡すと、起動時に失敗します。代わりにUnicodeを使用してください。

1.3a3(2011-12-21)

特徴

  • `` prequest``スクリプトを追加しました( `` paster request``の行に沿って)。これは&quot;コマンド行ピラミッド&quot;の章の &quot;要求の呼び出し&quot;の章に記載されています。
  • __discriminator__`` APIを派生したビュー呼び出し可能関数に追加しました。例えば、 `` adapters.lookup(...).__ discriminator __(文脈、要求) ``です。スーパーダイナミックシステムで使用されます。このシステムでは、手動ビュールックアップの後に識別器をイントロスペクションに使用する必要があります。

バグの修正

  • すべての `` p * スクリプト( `` pviews、 `` proutes``など)に対して正規化された終了値と `` -h``が出力されます。

ドキュメンテーション

  • &quot;コマンドラインピラミッド&quot;の章の&quot;コンソールスクリプトにスクリプトを作成する&quot;というセクションを追加しました。
  • メインのドキュメントから&quot;Google App EngineでPyramidを実行する&quot;チュートリアルを削除しました。それはCookbook(http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/gae.html)に掲載されています。理論的根拠:GAEのみのPython 2.5バージョンの正しい情報を提供します。このバージョンのPyramidはPython 2.5をサポートしていません。

1.3a2(2011-12-14)

特徴

  • 新しいAPI: `` pyramid.view.view_defaults``。クラスをビューとして使用する場合は、クラスの新しい `` view_defaults``クラスデコレータを使用して、そのクラスのメソッドを装飾するすべての `` @ view_config``デコレータによって使用されるビュー設定情報にデフォルトを提供できます。また、クラスを必須とするビュー構成に対しても機能します。
  • `` --list-templates``オプションの `` paster create``の処理をエミュレートするために、 `` pcreate``に後方互換性ノブを追加しました。
  • Pyramid 1.0.X、1.1.X、1.2.X、1.3.Xで機能する拡張スカフォールドを使いたい方に、足場の機械を少し変更しました。詳細については、物語ドキュメンテーションの新しい&quot;Creating Pyramid Scaffolds &quot;の章を参照してください。

ドキュメンテーション

  • `` view_defaults``クラスデコレータについては、「構成の表示」のドキュメンテーションの章にドキュメンテーションを追加しました。
  • `` view_defaults``クラスデコレータ用のAPIドキュメントを追加しました。
  • `` pyramid.scaffolds``にAPIドキュメントの章を追加しました。
  • &quot;Creating Pyramid Scaffolds &quot;というナレーション文書の章を追加しました。

後方の非互換性

  • `` pyramid.scaffolds.PyramidScaffold``の `` template_renderer``メソッドは `` render_template``に名前が変更されました。あなたがそれを上書きしていたなら、あなたは悪い人です。なぜならこれまではAPIではなかったからです。しかし、私たちはあなたが知っていることをうれしく思います。

1.3a1(2011-12-09)

特徴

  • Python 3.2との互換性。
  • 新しい `` pyramid.compat``モジュールと、Pyramidアドオンと開発環境をPython 2/3に跨って提供するAPIドキュメント。
  • Makoテンプレートを使用するための `` mako.directories``設定はもはや必要ありません。理由:Makoテンプレートレンダラーは絶対アセット仕様を使用して指定することができます。そのようなアセット仕様でアプリケーション全体を記述することができ、順序付けられた参照パスを必要としません。
  • `` pshell``での `` bpython``インタプリタの互換性。詳細については、「コマンドラインPyramid」ドキュメンテーションの章を参照してください。
  • `` get_appsettings`` API関数を `` pyramid.paster``モジュールに追加しました。この関数は、PasteDeployのiniファイルの `` [app:...] ``セクションで定義された設定を返します。
  • `` setup_logging`` API関数を `` pyramid.paster``モジュールに追加しました。この関数は、PasteDeployのiniファイルのロギング設定に従ってPythonロギングを設定します。
  • 設定の競合の報告は、より分かりやすい方法で報告されます(&quot;行11のファイル... &quot;対類似の情報の組です)。
  • 構成イントロスペクションシステムが追加されました。詳細については、「ピラミッド構成のイントロスペクション」というナレーションのドキュメントの章を参照してください。新しいAPI: `` pyramid.registry.Introspectable``、 `` pyramid.config.Configurator.introspector``、 `` pyramid.config.Configurator.introspectable``、 `` pyramid.registry.Registry.introspector``です。
  • `` pyramid.config.Configurator.action``メソッドに渡される余分なキーワード引数を許可します。
  • 新しいAPI: `` pyramid.path.AssetResolver``と `` pyramid.path.DottedNameResolver``です。前者は資産の仕様を解決するために使用され、後者はモジュールまたはパッケージに点滅した名前を解決するために使用されます。

バグの修正

  • テストスイートを32ビットシステムに渡す。 #286を終了する。 #306を終了する。 https://github.com/Pylons/pyramid/issues/286も参照してください。
  • `` pyramid.view.view_config``デコレータは `` match_params``述語引数を受け付けませんでした。 https://github.com/Pylons/pyramid/pull/308を参照してください。
  • AuthTktCookieHelperは、覚えておくべき `` tokens``引数が使われたときに、Unicodeヘッダを不適切に生成する可能性があります。 https://github.com/Pylons/pyramid/pull/314を参照してください。
  • AuthTktAuthenticationPolicyは、タイミング攻撃を認識する文字列比較器を使用しませんでした。詳細については、https://github.com/Pylons/pyramid/pull/320を参照してください。
  • `` pyramid.testing``のDummySessionは、新しいCSRFトークンがまだ存在しない場合、それを生成します。
  • `` request.static_url``はURLには適さない文字を含む `` path``引数を与えられたときにURL引用されたURLを生成するようになりました。詳細については、https://github.com/Pylons/pyramid/issues/349をご覧ください。
  • 足場のレンダリングが `` site``という名前にならないようにします(Python内部のsite.pyと競合します)。
  • `` pyramid.wsgi.wsgiapp``と `` pryramid.wsgi.wsgiapp2``関数のターゲットとしてインスタンスを使用するためのサポート。詳細については、https://github.com/Pylons/pyramid/pull/370を参照してください。

後方の非互換性

  • PyramidはPython 2.5(これは最近のJythonのリリースとこの記事の執筆時点でのPython 2.5バージョンのGAEを含む)では動作しません。
  • `` paster``コマンドは、もはやプロジェクトを作成したり、サーバを起動したり、デバッグコマンドを実行するための文書化された方法ではなくなりました。 scaffoldsからプロジェクトを作成するために、 `` paster create``は `` pcreate``コンソールスクリプトに置き換えられます。プロジェクトを提供するために、 `` paster serve``は `` pserve``コンソールスクリプトに置き換えられます。 `` pshell``、 `` pviews``、 `` proutes``、 `` ptweens``という新しいコンソールスクリプトは、 `` paster <commandname> ``相当することがあった。根拠:PasteとPasteScriptパッケージはPython 3では動作しません。
  • 新たにレンダリングされたスキャフォールディングからの `` pserve``の結果として実行されるデフォルトのWSGIサーバは、 `` paste.httpserver``サーバの代わりに `` wsgiref`` WSGIサーバになりました。根拠:根拠:PasteとPasteScriptパッケージはPython 3では動作しません。
  • `` pshell``コマンド(&quot;paster pshell &quot;を参照)は、 `` --disable-ipython``コマンドライン引数を受け付けません。代わりに、 `` -p``または `` --python-shell``引数を受け取ります。引数には、 `` python``、 `` ipython``、 `` bpython``のいずれかの値を指定できます。
  • `` pyramid.renderers.renderer_from_name``関数を削除しました。これはPyramid 1.0以来廃止され、決してAPIではありませんでした。
  • Pyramid&gt; = 1.3のバージョンでZCMLを使うには、 `` pyramid_zcml``のバージョン&gt; = 0.8と `` zope.configuration``のバージョン&gt; = 3.8.0が必要です。 `` pyramid_zcml``パッケージのバージョン0.8はPyramid 1.0まで下位互換性がありますので、古いバージョンがインストールされていて、Pyramid &quot;in-place &quot;をアップグレードしても警告は表示されません。単に代わりに壊れるかもしれません。

依存関係

  • ピラミッドは、テスト依存関係を除いて、 `` zope.component``パッケージに依存しなくなりました。
  • Pyramidは、zope.interface&gt; = 3.8.0、WebOb&gt; = 1.2dev、repoze.lru&gt; = 0.4、zope.deprecation&gt; = 3.5.0、translationstring&gt; = 0.4(Python 3との互換性のため)に依存しています。また、テストの依存関係として、同じ理由でWebTest&gt; = 1.3.1に依存します。
  • PyramidはPasteまたはPasteScriptパッケージに依存しなくなりました。

ドキュメンテーション

  • SQLAlchemy Wikiチュートリアルが更新されました。これは、 `` @ view_config``デコレータと明示的なデータベース投入スクリプトを使用します。
  • ZODB Wikiチュートリアルのマイナーアップデート。
  • &quot;拡張ピラミッド構成&quot;というナレーションのドキュメントの章が追加されました。新しいディレクティブを追加する方法と、カスタムディレクティブ内で `` pyramid.config.Configurator.action``メソッドを使用する方法について説明しています。また、イントロスペクトなオブジェクトを追加する方法についても説明します。
  • &quot;Pyramid Configuration Introspection &quot;というナレーション記述の章が追加されました。イントロスペクションシステムを照会する方法について説明します。

足場

  • レンダリングされた足場は、よりリロケータブルに変更されました(パッケージ内のファイル内でのパッケージ名の記述が少なくなりました)。
  • `` routesalchemy``足場は、古い(トラバーサルベースの) ``錬金術 ``足場(引退したもの)に取って代わり、 ``錬金術 ``に改名されました。
  • `` starter``スキャフォールドはデフォルトでURLディスパッチを使用するようになりました。

1.2(2011-09-12)

特徴

1.2b3(2011-09-11)

バグの修正

  • 静的ビューが&quot;include &quot;に追加された場合、ルートプレフィックスは考慮されませんでした。 https://github.com/Pylons/pyramid/issues/266を参照してください。

1.2b2(2011-09-08)

バグの修正

  • 1.2b1のtarballは、不適切な場所に迷いのある引用符が付いたファイル名が含まれていたため、特にWindowsユーザーにとってはブラウンバックでした。我々は `` setuptools-git``を使ってリリースタールボールを作ることに依存しています。1.2b1のtarballを生成するために実行されたとき、ファイル名に高位の文字を含むgitリポジトリに存在するファイルにはまだ対応しませんでした。

ドキュメンテーション

  • &quot;紹介&quot;物語の章のサンプルのアプリケーションと言葉に少し微調整。

1.2b1(2011-09-08)

バグの修正

  • 地域翻訳(de_DE``)から言語翻訳( `` de``)に時折戻ってしまうと、ローカライザを使用すると正しく動作しないことがあります。 https://github.com/Pylons/pyramid/issues/263を参照してください。
  • 静的ファイル提供機構は、 ``。 &#39;&#39;(ドット)文字で始まったファイルを扱うことができませんでした。
  • 名前に上位の(超ASCII)文字を含む静的ファイルは、静的ビューでは処理できませんでした。ファイルシステムからファイルを要求する際に、静的ファイル提供機構が不適切にURLを引用したファイルセグメントをファイル名で引用します。
  • `` pyramid.traversal.traversal_path``の中で、URLセグメントをUTF-8からUnicodeに正規化してから、セグメントが `` .``、空文字列、または `..`のいずれかに文字通り一致するかどうかを確認します誰かがUTF-8でこれらの文字列をトンネルして、デコードされる前にリテラルと一致しないようなやりかたの方法です。

ドキュメンテーション

  • はじめにの説明の章に&quot;ユニークなものは何になるのか&quot;のセクションを追加しました。

1.2a6(2011-09-06)

バグの修正

内部

  • 以前は `` paste.auth``モジュールからのインポートとして依存していたコードを内部化しました(将来的には防御的です)。
  • `` paste.urlparser.StaticURLParser``の使用を、Chris Rossiの&quot;ハッピー&quot;静的ファイル提供コード(futureproof)の派生物に置き換えました。
  • 固定テストスイート。一部のシステムでは、不確定テスト実行順序と共有テスト変数のダブルプッシュ - シングルポップのためにテストが失敗することがあります。

行動の違い

  • 静的ファイルを提供するときにETagヘッダーが設定されなくなりました。代わりにLast-Modifiedヘッダーが設定されます。
  • 静的ファイルの提供は `` wsgi.file_wrapper``拡張子をサポートしなくなりました。
  • ファイルアクセス権のためにPyramidプロセスのユーザがアクセスできない静的ファイルが提供されたときに `` 403 Forbidden``エラーを返す代わりに、IOError(または類似のもの)が発生します。

足場

  • すべてのスカフォールドは `` cache_max_age``パラメータを `` add_static_view``メソッドに送ります。

1.2a5(2011-09-04)

バグの修正

  • 特定の状況でルートを登録するとき、コンフィギュレータの `` route_prefix``が適切に考慮されていませんでした。 https://github.com/Pylons/pyramid/issues/260を参照してください。

依存関係

  • `` zope.configuration``パッケージはもはや依存関係ではありません。

1.2a4(2011-09-02)

特徴

  • `` pyramid.config.Configurator.scan() ``に対する `` onerror``キーワード引数をサポートします。このonerrorキーワード引数は `` venusian.Scanner.scan() ``に渡され、スキャン中に例外が発生した場合のエラー動作に影響を与えます。
  • `` pyramid.config.Configurator.add_view``と `` pyramid.config.Configurator.add_route``への `` request_method``述語引数は、HTTPメソッド名のタプルであることが許可されています。以前は、単一のHTTPメソッド名を表す文字列に限定されていました。
  • 未使用の `` pyramid.traversal.find_model``、 `` pyramid.traversal.model_path``、 `` pyramid.traversal.model_path_tuple``、および `` pyramid.url.model_url``はPyramid 1.0で廃止されました。名前が変更された `` resource_ * ``接頭辞付き関数のエイリアスとして永遠に残すことは、それほどコストがかかりません。
  • 未使用の `` pyramid.view.bfg_view``は、Pyramid 1.0で廃止されました。これは `` pyramid.view.view_config``への低コストのエイリアスです。これは永遠に残しておきます。

依存関係

  • Pyramidは、 `` pyramid.config.Configurator.scan``の `` onerror``キーワード引数をサポートするために、Venusian 1.0a1以上を必要としています。

1.2a3(2011-08-29)

バグの修正

  • Pyramidは、1.2a1で行われたリファクタリングのために、呼び出し元パッケージの相対パスが渡されたときに、 `` pyramid.url.static_url``を使って静的URLを適切に生成しませんでした。
  • `` settings``オブジェクトは、 `` __getattr__``が呼び出されたときに非推奨警告を出しました。しかし、 `` __getattr__``が任意のオブジェクトに対して呼び出される正当な状況があります(例えば `` hasattr``など)。現在、 `` settings``オブジェクトは、検索が成功すると警告を出すだけです。

内部

  • 新しいレンダラーヘルパー(クリーンアップ)を作成するのではなく、view_configデコレータで `` config.with_package``を使用してください。

1.2a2(2011-08-27)

バグの修正

  • Configuratorコンストラクタに `` renderers = ``引数が指定されていない場合、デフォルトのレンダラーセットを熱心に登録してコミットします。これにより、Configuratorの構築直後にコミットせずに1.2a1で壊れていたデフォルトのレンダラのオーバーライドが可能になります。
  • Makoのレンダリング例外では、エラーメッセージの値が間違っていました。
  • Configuratorのコンストラクタは無条件で &quot;ユーザーの言葉&quot;のように扱われるため、インクルードはルートファクトリを正常に設定できませんでした。

特徴

  • セッションファクトリは、点線の名前構文を使用して渡すことができるようになりました。

1.2a1(2011-08-24)

特徴

  • ini設定ファイルの `` [pshell] ``セクションは `` setup``キーを、ブートストラップ環境に渡される呼び出し可能ファイルを指す点線の名​​前として扱うようになりました。それは、大正義のために必要に応じて環境を変えることができます。

  • `` pyramid.includes``という名前の新しい設定が利用可能になりました。これは&quot;環境変数と` `.ini``ファイル設定&quot;ナレーション文書の章に記述されています。

  • `` pyramid.config.Configurator.include``メソッドに `` route_prefix``引数を追加しました。この引数を使用すると、URLディスパッチアプリケーションを一緒に作成できます。 &quot;URL Dispatch narrative documentation&quot;の章の &quot;アプリケーションを作成するためのルートプレフィックスの使用&quot;を参照してください。

  • `` pyramid.security.NO_PERMISSION_REQUIRED``定数を、 `` permission = ``文で使用して設定を表示するようにしました。この定数は文字列 `` __no_permission_required__``の値を持ちます。この文字列値は、以前はドキュメントで参照されていました。ドキュメントは定数を使用するようになりました。

  • レスポンスアダプタを設定するデコレータベースの方法を追加しました: `` pyramid.response.response_adapter``。このデコレータは `` pyramid.config.Configurator.add_response_adapter``と同じ用途を持ちますが、宣言的です。

  • `` pyramid.events.BeforeRender``イベントには `` rendering_val``という名前の属性が追加されました。これは、BeforeRenderサブスクライバのビューによって返された値をイントロスペクションするために使用できます。

  • 新しい設定ディレクティブ: `` pyramid.config.Configurator.add_tween``。このディレクティブは&quot;tween &quot;を追加します。 &quot;tween &quot;は、ピラミッドルータのプライマリリクエスト処理関数をラップするために使用されます。これはPyramidフレームワーク拡張で、タイミングのサポートを表示したり、簿記コードを置くのに便利な場所を提供するために使用できる機能です。

    Tweensについては、&quot;Registering Tweens &quot;というHooksの章のナレーション文書セクションで詳しく説明しています。

  • 詳細については、解説書のCommand-Line Pyramidの章にある &quot;Tweensの表示&quot;という節を参照してください。

  • Pyramidデバッグロガーは、標準のロギング設定を使用するようになりました(通常は、スタートアップの一部としてPasteで設定されます)。これは、例えば `` debug_notfound``、 `` debug_authorization``などからの出力が通常のロギングチャネルに行くことを意味します。デバッグロガーのロガー名は、コンフィグレータのコンストラクタの* caller *のパッケージ名になります。

  • 新しい属性はリクエストオブジェクトで利用できます: `` exc_info``。 Pyramidルータが例外をキャッチするまで、その値は `` None``になります。その後、 `` sys.exc_info() ``の結果になります。

  • `` pyramid.testing.DummyRequest``は `` add_finished_callback``メソッドと `` add_response_callback``メソッドを実装しました。

  • `` pyramid.config.Configurator``クラスの新しいメソッド: `` set_authentication_policy``と `` set_authorization_policy``。これらは主にアドオンの作者によって消費されることを意図しています。

  • 新しいコンフィグレータメソッド: `` set_root_factory``。

  • Pyramidは、コンストラクタの構築時にいくつかのデフォルトのコンフィグレーション文をコミットせず、コンストラクタ引数(例: `` authentication_policy``と `` authorization_policy``)として渡された値が&quot;include &quot;で取得された同じ設定をオーバーライドします。

  • `` pyramid.mako_templating.MakoRenderingException``を使って例外をレンダリングしたほうがよかったです

  • 新しいリクエストメソッド: `` current_route_url``、 `` current_route_path``、および `` static_path``。

  • `` pyramid.url``: `` current_route_path``と `` static_path``の新機能です。

  • `` pyramid.request.Request.static_url`` API(およびその兄弟の `` pyramid.request.Request.static_path``、 `` pyramid.url.static_url``、 `` pyramid.url.static_path``)は、 asboluteファイル名を&quot;path &quot;引数として受け入れるようになりました。これにより、ファイル名が以前に静的ビューとして登録されていたディレクトリにある限り、アセットへのURLが生成されます。以前は、絶対ファイルパスを使用してアセットへのURLを生成しようとすると、ValueErrorが発生しました。

  • `` RemoteUserAuthenticationPolicy `` AuthTktAuthenticationPolicy、および `` SessionAuthenticationPolicy``のコンストラクタは、 `` debug``というキーワード引数を追加できるようになりました。デフォルトでは、このキーワード引数は `` False``です。 `` True``の場合、これらのポリシーのいずれかで `` authenticated_userid``または `` effective_principals``メソッドが呼び出されると、デバッグ情報がPyramidデバッグロガー(通常はstderr)に送られます。生成された出力は、認証関連の問題を診断するときに役立ちます。

  • 新しいビュー述語: `` match_param``。例: `` config.add_view(aview、match_param = &#39;action = edit&#39;) ``で追加されたビューは `` request.matchdict``の中に `` action``という名前の値がある場合にのみ呼び出されます。 `` edit``の値です。

内部

  • Pyramid &quot;exception view &quot;機構は今や&quot;tween &quot;( &quot;pyramid.tweens.excview_tween_factory``)として実装されています。
  • WSGIHTTPException(HTTPFound、HTTPNotFoundなど)にWSGI環境が提供されているときに本文とコンテンツタイプをレンダリングする&quot;prepare &quot;という名前の新しいAPIが追加されました。デバッグツールバーに必要です。
  • WSGIHTTPExceptionで `` __call__``や `` prepare``が呼び出されると、本体が設定され、その後の `` __call__``への呼び出しは常に同じ本体を返します。例外の本文を再レンダリングするには、body属性を削除します。
  • 以前は `` pyramid.events.BeforeRender``イベントは辞書をラップしました(それは `` _system``属性として扱いました)。今は*辞書です( `` dict``から継承しています)。これはテンプレートに渡される値で、トップレベルの辞書になります。
  • `` pyramid.url``パッケージの `` route_url``、 `` route_path``、 `` resource_url``、 `` static_url``、 `` current_route_url``関数は、リクエストのメソッドに委譲します彼らは他の方法の代わりに、渡されてきました。 pyramid.request.Requestオブジェクトはpyramid.url.URLMethodsMixinというミックスインを継承し、これを可能にし、すべてのURL /パス生成ロジックがこのミックスインに組み込まれています。
  • `` pyramid.config``をパッケージにリファクタリングします。
  • コンフィギュレータの `` _set_security_policies``メソッドを削除しました。
  • `` StaticURLInfo``クラスを `` pyramid.static``から `` pyramid.config.views``に移動しました。
  • `` Settings``クラスを `` pyramid.settings``から `` pyramid.config.settings``に移動してください。
  • `` OverrideProvider``、 `` PackageOverride``、 `` DirectoryOverride``、および `` FileOverride``クラスを `` pyramid.asset``から `` pyramid.config.assets``に移動します。

廃止

  • すべてのPyramid関連のデプロイメント設定( `` debug_all``、 `` debug_notfound``など)に接頭辞 `` pyramid``を付けることになっています。例: `` debug_all`` - &gt; `` pyramid.debug_all``です。古いプレフィックスが設定されていない設定は引き続き無期限に機能しますが、それらを指定すると、最終的に廃止予定の警告が表示されることがあります。すべての足場とチュートリアルは、プレフィックス設定を使用するように変更されました。
  • `` settings``ディクショナリは `` __getitem__``の代わりに `` __getattr__``経由で値にアクセスしようとすると非推奨の警告を出します。

後方の非互換性

  • 文字列がコンフィグレータに `` debug_logger``パラメータとして渡された場合、その文字列はロガーのインスタンスへのドット付きの名前ではなく、グローバルなPythonのロガーの名前と見なされます。

  • `` pyramid.config.Configurator.include``メソッドは、単一の `` callable``引数(許可された呼び出し元のシーケンス)のみを受け入れるようになりました。複数の `` callable``を `` pyramid.config.Configurator.include``に渡すと、それは中断されます。代わりに、各呼び出し可能メソッドのメソッドを別々に呼び出す必要があります。この変更は、includeの `` route_prefix``機能をサポートするために導入されました。

  • &quot;自動コミット&quot;コンフィグレータを使用する場合は、設定ルートとビューステートメントをより厳密に順序付ける必要があります。以前は、自動コミット・コンフィグレータを使用したときに、その名前のルートを追加する前にルート名を指定したビューを追加することができました。例えば::

    config = Configurator(autocommit=True)
    config.add_view('my.pkg.someview', route_name='foo')
    config.add_route('foo', '/foo')
    

    ビューがそれ自身を追加しようとすると、上記の例外が発生します。ビューを追加する前にルートを追加する必要があります:

    config = Configurator(autocommit=True)
    config.add_route('foo', '/foo')
    config.add_view('my.pkg.someview', route_name='foo')
    

    これは普通のユーザには影響せず、自動コミットのコンフィグレータを使ったレガシーBFGコードベースを持っていて、おそらくコンフィグレータAPIを使うテスト( `` pyramid.testing.setUp``で返されたコンフィグレータはオートコミッティングコンフィギュレータ)。これを回避する適切な方法は、これらのディレクティブの順序付け要件を持たない非自動コミット・コンフィグレータ(デフォルト)を使用することです。

  • `` pyramid.config.Configurator.add_route``ディレクティブはルートオブジェクトを返さなくなりました。この変更は、ルートとビューの構成処理を適切に動作させるために必要でした。

ドキュメンテーション

  • `` pyramid.url``パッケージの `` route_url``、 `` route_path``、 `` resource_url``、 `` static_url``、および `` current_route_url``関数を使った説明とAPIのドキュメントは、今や代わりにリクエストの名義的なメソッドを使用するように変更されました。
  • 「アプリケーションを作成するためのルートプレフィックスの使用」というタイトルのセクションを&quot;URLディスパッチ&quot;ナレーションドキュメントの章に追加しました。
  • API docs: `` pyramid.tweens``に新しいモジュールを追加しました。
  • &quot;フックn&quot;の説明の章に&quot;Registering Tweens &quot;セクションを追加しました。
  • &quot;コマンドラインピラミッド&quot;の説明の章に&quot;Tweens &quot;セクションを追加しました。
  • `` pyramid.tweens``と `` pyramid.includes``の環境設定を環境変数と `` .ini``ファイル設定の章に追加しました。
  • 物語のドキュメンテーションにロギングの章を追加しました(Pylonsのロギングドキュメントに基づいて、Philに感謝します)。
  • 物語のドキュメントにペーストの章を追加しました(プロジェクトの章から移動した内容)。
  • 辞書のメソッドを表す `` pyramid.interfaces.IDict``インターフェースをドキュメント化のためだけに追加しました(IMultiDictとIBeforeRenderはそれを継承しています)。
  • すべてのチュートリアルでは、ピラミッドからインポートされた関数バリエーションではなく、リクエストの `` route_url``、 `` route_path``、 `` resource_url``、 `` static_url``、 `` current_route_url``メソッドを使用しています.url``。
  • ZODB wikiチュートリアルでは、 `` repoze.zodbconn``パッケージではなく `` pyramid_zodbconn``パッケージを使用して、ZODB統合を提供しています。

依存関係の変更

  • PyramidはPasteScript&gt; = 1.7.4に依存しています。このバージョンには、柔軟なログ設定を可能にするために重要な機能が含まれています。

足場

  • すべてのスカフォールドは、トランザクション管理を管理するために `` repoze.tm2``ミドルウェアではなく、 `` pyramid_tm``パッケージを使用します。
  • ZODBスキャフォールドはZODB統合を提供するために `` repoze.zodbconn``パッケージではなく `` pyramid_zodbconn``パッケージを使用するようになりました。
  • すべての足場は対話的なデバッグ機能を提供するために `` WebError``パッケージではなく `` pyramid_debugtoolbar``パッケージを使用します。
  • 足場で作成されたプロジェクトは、 `` WebError``パッケージに全く依存しなくなりました。 `` error_catcher``ミドルウェアを必要としていた `` production.ini``ファイルの設定が削除されました。エラー捕捉/電子メールの送信を設定することは、 `` pyramid_exclog``パッケージのドメインになりました(http://docs.pylonsproject.org/projects/pyramid_exclog/en/latest/を参照)。

バグの修正

1.1(2011-07-22)

特徴

  • `` pyramid.renderers.null_renderer``オブジェクトをAPIとして追加しました。 nullレンダラーは、ビュー構成のレンダラー= ``引き数への入力として高度な統合のケースで使用できるオブジェクトです。 nullレンダラーをビューレンダラー引数として使用すると、Pyramidはビューの呼び出し可能な結果を​​Responseオブジェクトに変換することを回避します。これは、Pyramidルーターが使用しているコンテキスト外で、ビュー構成とルックアップマシンを再利用する場合に便利です。この機能は `` pyramid_rpc``パッケージが消費するために追加されました。このパッケージは、まさにこのようにルータのコンテキスト外でビューの設定とルックアップを使用します。 `` pyramid_rpc``は1.1b1以降1.1で壊れました。それを追加することで、私たちはそれを再び働かせることができます。
  • docs.pylonsproject.orgを指すすべての足場テンプレートを、 `` / projects / pyramid / dev``ではなく `` / projects / pyramid / current``を使うように変更してください。

内部

  • Python 2.4との下位互換性を提供する目的のみに役立つ `` compat``コードを削除します。
  • 野生で使用されている非API関数 `` pyramid.renderers.renderer_from_name``の非推奨警告を追加しました。
  • `` pyramid.view.view_config``デコレータで使用する `` pyramid.renderers.RendererHelper``に `` clone``メソッドを追加してください。

ドキュメンテーション

  • wiki2(SQLA + URL Dispatch)チュートリアルの2つのタイプミスを修正しました。
  • 新しいユーザーの使いやすさのために、物語セクションの章を並べ替えました。
  • ドキュメントのセクションにインデックスマーカーを追加しました。

1.1b4(2011-07-18)

ドキュメンテーション

  • &quot;コマンドラインピラミッド&quot;の章に &quot;スクリプトを書く&quot;というセクションを追加しました。

後方の非互換性

  • `` pyramid.scripting.make_request`` APIを1.1b3にあまりにも急激に追加しました。削除されました。ご不便をかけて申し訳ありません。代わりに `` pyramid.request.Request.blank`` APIを使用してください。

特徴

  • 後述する `` paster pshell``、 `` paster pviews``、 `` paster proutes``コマンドは `` pyramid.paster.bootstrap``を使用して `` .ini ``ファイル名を指定せずに、実際のピラミッドアプリケーションを指し示すファイルを探します。代わりに、一般的には `` paster {pshell | proutes | pviews} development.ini``を実行することができ、それはほとんど正しいことをします。

バグの修正

  • `` pyramid.httpexceptions.WSGIHTTPException._set_default_attrs``でカスタム例外テンプレートをレンダリングするときにカスタム環境変数を省略します。文字列化すると、実行すべきではないコードがトリガされます。 https://github.com/Pylons/pyramid/issues/239を参照してください。

1.1b3(2011-07-15)

特徴

  • ビューの半機能テストを容易にするためにコーナーケースを修正する:再レンダリング時に古いレジストリをクリアするために新しいレンダリングリンゴを作成する。 https://github.com/Pylons/pyramid/pull/234を参照してください。

  • 新しいAPIクラス: `` pyramid.static.static_view``。これは廃止された `` pyramid.view.static``クラスに取って代わるものです。 `` pyramid.static.static_view``は、デフォルトでは、リクエストの `` path_info``属性の結果として文書を提供します。属性は `` subpath``属性ではありません(逆は `` pyramid.view.static`` 、まだあります)。 ` pyramid.static.static_view``は `` use_subpath``フラグを公開します。これは、静的ビューを古い非推奨バージョンと同じように動作させたい場合に使用します。

  • 新しいAPI関数 `` pyramid.paster.bootstrap``が追加され、Pyramid環境を簡単にブートストラップするスクリプトを作成しました。例えば:

    from pyramid.paster import bootstrap
    info = bootstrap('/path/to/my/development.ini')
    request = info['request']
    print request.route_url('myroute')
    
  • 新しいAPI関数 `` pyramid.scripting.prepare`が追加されました。これは、 `` pyramid.paster.boostrap``の下位レベルのアナログであり、設定ファイル引数の代わりに要求とレジストリを受け入れ、同じ目的で使用されます。

    from pyramid.scripting import prepare
    info = prepare(registry=myregistry)
    request = info['request']
    print request.route_url('myroute')
    
  • 新しいAPI関数 `` pyramid.scripting.make_request`が追加されました。結果として得られるリクエストは `` registry``属性を持ちます。 `` pyramid.scripting.prepare``や `` pyramid.paster.bootstrap``(どちらも引数としてリクエストを受け付けます)と一緒に使用することを意図しています:

    from pyramid.scripting import make_request
    request = make_request('/')
    
  • 新しいAPI属性 `` pyramid.config.global_registries``は、 `` pyramid.config.Configurator.make_app``を介して現在のプロセスに読み込まれたすべてのPyramidレジストリへの参照を含む反復可能なオブジェクトです。最後にロードされたレジストリを含む `` last``属性もあります。これはスクリプティング機器で使用され、イントロスペクションに使用できます。

廃止

  • `` pyramid.view.static``クラスは、より新しい `` pyramid.static.static_view``クラスのために推奨されなくなりました。非推奨警告は使用時に発生します。 `` use_subpath = True``引数で `` pyramid.static.static_view``への参照で置き換えるべきです。

バグの修正

  • domain / localeの組み合わせに対してmoファイルがロードされていなければ、そのドメイン/ロケールの組み合わせを使用して実行される `` pyramid.i18n.Localizer.pluralize``は、変換不可能な&quot;変換オブジェクトにはattr &#39;複数の&#39; &quot;エラーがありません。さて、代わりに&quot;works &quot;(デフォルトではドイツ語の複数形を使用しています)。利用可能なロケール/ドメインの翻訳なしで何かを複数形にしようとするのは無意味ですが、この動作は `` pyramid.i18n.Localizer.translate``の動作と一致します。 https://github.com/Pylons/pyramid/issues/235を参照してください。

1.1b2(2011-07-13)

特徴

  • 新しい環境設定 `` PYRAMID_PREVENT_HTTP_CACHE``と新しい設定ファイルの値 `` prevent_http_cache``です。これらは同義語であり、プロセス内でグローバルにPyramidの `` http_cache``機構によってHTTPキャッシュヘッダーが設定されないようにします。 &quot;構成の表示&quot;の章の&quot;Influencing HTTP Caching &quot;セクションと&quot;環境変数と構成設定&quot;の説明の章のこの設定の詳細ドキュメントを参照してください。

行動の変化

  • 以前は、 `` BeforeRender``イベントサブスクライバが、イベントオブジェクトの `` __setitem__``または `` update``メソッドを介してレンダラーグローバルディクショナリにすでに存在するキーで値を追加した場合、 `` KeyError``提起されました。コンフィギュレータの&quot;add_renderer_globals &quot;機能の廃止により、既に存在していたレンダラグローバルディクショナリの既存の値を上書きする方法はありませんでした。さて、イベントオブジェクトは、 `` __setitem__``または `` update``が呼び出されたとき(新しい `` setdefault``メソッドと同様に)、グローバルディクショナリにすでにある古い値を上書きします古い辞書。その結果、他のサードパーティの加入者との最大限の相互運用性を実現するために、BeforeRenderサブスクライバとして使用する予定のイベントサブスクライバを書くと、サブスクライバコードが必要になります( `` .get``または ``____ __contains__``オーバーライド値を設定する前に、レンダラーグローバルディクショナリに値が存在しないことを確認します。

バグの修正

  • `` Configurator.add_route``メソッドは、中間の `` config.commit() ``なしで同じルートを持つ2つのルートを追加することを許可しました。起動時に `` ConfigurationError``が `` add_route``に関連しているように見える場合は、a)すべてのルート名が一意であることを確認するか、またはb) `` config.commit以前に追加された名前の名前を持つ第2のルートを追加する前に、または `` autocommit``モードで動作するConfiguratorを使用してください。
  • `` pyramid_routesalchemy``と `` pyramid_alchemy``足場は、 `` transaction.abort() ``の代わりに `` DBSession.rollback() ``を不適切に使用していました。
  • 私たちは例外ビューを呼び出す前に `` request.response``をクリアします。例外ビューは、例外の前にどのコードでも触れられていないrequest.responseで動作します。
  • `` zope.interface`` 3.6.4以上でPyramidを使用すると、ルート名にスペースが含まれているルートに関連するビューが正しくルックアップされていない可能性があります。 https://github.com/Pylons/pyramid/issues/232を参照してください。

ドキュメンテーション

  • Wiki2(SQLAlchemy + URL Dispatch)チュートリアル `` models.initialize_sql``は、同じ名前の `` pyramid_routesalchemy``スカフォールド関数と一致しませんでした。それは足場で変更された時には同期しなかった。
  • 「構成の設定」の説明の章の新しい文書のセクション:&quot;HTTPキャッシュの影響&quot;

1.1b1(2011-07-10)

特徴

  • 引数に指定されているpaste iniファイルセクション名がPyramid WSGIアプリケーションではない場合でも、 `` paster pshell``を呼び出すことが可能になりました。シェルは劣化モードで動作し、ユーザーに警告します。 &quot;Pyramid Projectの作成&quot;ドキュメンテーションセクションの&quot;The Interactive Shell &quot;を参照してください。

  • `` paster pshell``は、デフォルトで( `` app``と `` settings``を含む)より多くの組み込みのグローバル変数を提供します。 &quot;Pyramid Projectの作成&quot;ドキュメンテーションセクションの&quot;The Interactive Shell &quot;を参照してください。

  • 現在、アプリケーションの.ini設定ファイルに `` [pshell] `セクションを追加することができます。これは、pshellセッションで使用できるグローバル名に影響します。 &quot;ピラミッドプロジェクトの作成&quot;ドキュメンテーションの章の&quot;シェルを拡張する&quot;を参照してください。

  • `` config.scan``メソッドは `` ** kw``引数を増やしました。 `` kw``引数は、ピラミッドが作成したVenusianの `` Scanner``オブジェクトに渡すキーワード引数の集合を表します。 ( `` Scanner``の詳細については、Venusianのドキュメントを参照してください)。

  • 新しいリクエストプロパティ: `` json_body``。このプロパティは、リクエスト本体のJSONでデコードされた変形を返します。要求の本文が整形式JSONでない場合、このプロパティは例外を発生させます。

  • 新しい値 `` http_cache``をビュー設定パラメータとして使うことができます。

    ビュー設定に `` http_cache``値を指定すると、関連するview呼び出し可能で生成されたレスポンスの `` Expires``と `` Cache-Control``ヘッダーが変更されます。 `` http_cache``の値は次のいずれかです:

    • 非ゼロの整数。ゼロ以外の整数の場合、秒数として扱われます。この秒数は、このビューを呼び出すリクエストに対するレスポンスの `` Expires``ヘッダと `` Cache-Control:max-age``パラメータを計算するために使用されます。たとえば、 `` http_cache = 3600``は、リクエストしているブラウザに「この応答を1時間キャッシュしてください」と指示します。
    • `` datetime.timedelta``インスタンスです。 `` datetime.timedelta``インスタンスの場合、秒数に変換され、その秒数が `` Expires``ヘッダーと `` Cache-Control:max-age &#39;&#39;を計算するために使われますこのビューを呼び出す要求への応答のパラメータ。例: `` http_cache = datetime.timedelta(days = 1) ``は、リクエストしているブラウザに「この応答を1日キャッシュしてください」と指示します。
    • 0( `` 0``)。値がゼロの場合、このビューからのすべての応答に存在する `` Cache-Control``と `` Expires``ヘッダーは、クライアントブラウザのキャッシュ(および任意の中間キャッシュ)にレスポンスをキャッシュしないように構成されます。
    • 2タプル。それが2つのタプル(例えば `` http_cache =(1、{&#39;public&#39;:True)) ``)の場合、タプルの最初の値は非ゼロの整数か `` datetime.timedelta``インスタンスです。どちらの場合も、この値はレスポンスをキャッシュする秒数として使用されます。タプルの2番目の値は辞書でなければなりません。辞書にある値は `` Cache-Control``レスポンスヘッダへの入力として使われます。例えば、 `` http_cache =(3600、{&#39;public&#39;:True})は ``キャッシュを1時間意味し、 `` public``をレスポンスのCache-Controlヘッダに追加します。 `` webob.cachecontrol.CacheControl``インターフェースでサポートされているすべてのキーと値を辞書に追加することができます。 `` {&#39;public&#39;:True} ``を提供することは、 `` response.cache_control.public = True``を呼び出すことと等価です。

    `` http_cache``として非タプルの値を与えることは、あなたのビューのボディ内で `` response.cache_expires(value) ``を呼び出すことと同じです。

    `` http_cache``として2タプルの値を与えることは、あなたのビューのボディ内で `` response.cache_expires(value [0]、** value [1]) ``を呼び出すのと同じです。

    `` Expires``ヘッダーに影響を与えず、 `` Cache-Control``ヘッダにのみ影響を与えたい場合は、 `` None``の最初の要素を持つ `` http_cache``としてタプルを渡し、例: ``(None、{&#39;public&#39;:True}) ``

バグの修正

  • 元のビューのフレームワークラッパー(http_cachedなど)は、受信した応答がIResponseであることを信頼できることに依存していました。これは、必ずしもそうではありませんでした。なぜなら、応答は、ラップの初期段階ではなくルータによって解決されたからです。これは修正されました。

ドキュメンテーション

  • &quot;Webob &quot;章に&quot;JSONエンコードされたリクエスト本体を扱う&quot;というセクションを追加しました( `` request.json_body``の使用法)。

行動の変化

  • `` paster pshell``、 `` paster proutes``、 `` paster pviews``コマンドは、前の2つではなく `` / path / to / config.ini#sectionname``の形式で引数を取るようになりました - 引数の `` /path/to/config.ini sectionname``のスペルです。 ``#sectionname``は省略できます。この場合、 ``#main``が仮定されます。

1.1a4(2011-07-01)

バグの修正

  • `` pyramid.testing.DummyRequest``は `` pyramid.request.Request``で廃止された属性にアクセスするとき( `` response_content_type``のように)、廃止予定の警告を出します。これは、&quot;実際の&quot;要求の代わりにDummyRequestを使用するユニットテストを実行している人々の利益のためです。機能テストスイートを必要とせずに廃止されたことを知っています。

  • `` pyramid.events.subscriber``ディレクティブは、複数のインタフェースオブジェクトをコンストラクタに渡すと、ドキュメンテーションとは逆の動作をします。たとえば、次のリスナーが登録されているとします。

    @subscriber(IFoo, IBar)
    def expects_ifoo_events_and_ibar_events(event):
        print event
    

    イベントの章docsは、リスナーが登録され、 `` IFoo``と `` IBar``イベントの両方を聞くと主張しました。代わりに、IObjectEventが発行され、オブジェクトインタフェースが &quot;IFoo&quot;で、イベントインタフェースが &quot;IBar&quot;であった場合にのみ呼び出される&quot;オブジェクトイベント&quot;サブスクライバを登録しました。

    この動作はドキュメントと一致するようになりました。オブジェクトイベントサブスクライバを登録するために1.0の `` subscriber``ディレクティブのバグの振る舞いに頼っていた場合、オブジェクトイベントのサブスクライバを登録することを示すシーケンスを渡す必要があります。例えば::

    @subscriber([IFoo, IBar])
    def expects_object_event(object, event):
        print object, event
    

特徴

  • JSONPレンダラーを追加します(ドキュメントのレンダラーの章にある&quot;JSONPレンダラー&quot;を参照)。

廃止

  • コンフィグレータの `` set_renderer_globals_factory``メソッドと `` renderer_globals``コンフィグレータコンストラクタパラメータを廃止しました。

ドキュメンテーション

  • WikiとWiki2チュートリアルの &quot;Tests&quot;章にはそれぞれ2つのバグがありました.WebTestに依存するようにユーザーに指示しておらず、Pyramid自体の変更の結果として2つのテストが失敗しました。これらの問題は修正されました。
  • 1.0.X CHANGES.txtエントリをHISTORY.txtに移動します。

1.1a3(2011-06-26)

特徴

  • `` mako.preprocessor``設定ファイルのパラメータを追加しました。 MakoプリプロセッサをPythonの呼び出し可能な名前またはPythonの点名として指定することができます。根拠については、https://github.com/Pylons/pyramid/pull/183を参照してください。

バグの修正

  • 実際にクラスメソッドであったカスタム述語に `` __text__``属性を設定しようとすると、PyramidはConfiguratorでAttributeErrorを発生させます。 https://github.com/Pylons/pyramid/pull/217を参照してください。
  • 要求時に廃止されたresponse_ * attrsにアクセスしたり設定したりすると( `` response_content_type``など)、レンダリング時ではなくアクセス時に非推奨警告が発行されるようになりました。

1.1a2(2011-06-22)

バグの修正

  • 1.1a1は、 `` pyramid.paster.PyramidTemplate``に下位互換性のあるimport shimを提供しないことによってAkhetを壊しました。 Akhetがそれをインポートすると非推奨の警告が出されますが、今では1つが追加されました。
  • `` config.add_translation_dirs``への一回の呼び出しで複数の仕様が提供された場合、ディレクトリはディレクトリリストの先頭に間違った順序で挿入されました。 `` * specs`` list(リストの後ろにある項目はリストの前に追加されています)。これは修正されました。

後方の非互換性

  • ピラミッドルータは、エラー処理中に `` repoze.bfg``のために書かれたアプリケーションとの下位互換性のためにビュー関連の例外を検出したときに、キー `` environ [&#39;repoze.bfg.message&#39;] ``に値を設定しようとしました。これは、次のようなコードを使用してこれを行いました:

    # "why" is an exception object
    try:
        msg = why[0]
    except:
        msg = ''
    
    environ['repoze.bfg.message'] = msg
    

    値 `` environ [&#39;repoze.bfg.message&#39;] ``の使用は、Pyramid 1.0で廃止されました。私たちの定める方針は、完全な2つのメジャーリリースに対する非推奨の機能を削除しないことです。このコードはもともとPyramid 1.2で削除される予定でした。しかし、 `` repoze.bfg.message``値を計算することは、野生で見つかった少なくとも1つのバグ(https://github.com/Pylons/pyramid/issues/199)のソースであり、下位互換性を維持し、バグを修正するための完全な方法です。したがって、このリリースでは値を設定するコードは削除されています。環境におけるこの値の存在に依存する例外ビューのコードは、要求の `` exception``属性(例えば、 `` request.exception [0] ``)を使用して、 `` request .environ [&#39;repoze.bfg.message&#39;] ``

1.1a1(2011-06-20)

ドキュメンテーション

  • 「テンプレート」とは、「ペーストテンプレート」と「レンダリングテンプレート」(レンダリングエンジンで作成されたテンプレート、つまりMako、Chameleon、Jinjaなど)の両方を指します。 &quot;Paster templates &quot;は&quot;scaffolds &quot;と呼ばれますが、&quot;rendered templates &quot;の名前は&quot;templates
  • `` wiki``(ZODB + Traversal)チュートリアルは少し更新されました。
  • `` wiki2``(SQLA + URL Dispatch)チュートリアルは若干更新されました。
  • `` pyramid.interfaces.IAuthenticationPolicy``と `` pyramid.interfaces.IAuthorizationPolicy``の公開インタフェースを作って、 `` pyramid.authentication``と `` pyramid.authorization`` APIドキュメントで参照してください。
  • 公開された各インタフェースの関数定義を `` pyramid.interfaces``でレンダリングします。
  • 見つからないドキュメントの参照を `` pyramid.config.Configurator.set_view_mapper``に追加し、&quot;ビューマッパーの使用&quot;というHooksの章のセクションを参照してください。
  • &quot;環境変数と` `.ini``ファイル設定章にセクションを追加しました。&quot;カスタム設定の追加&quot;と書かれています。
  • &quot;multidict &quot;(例えば、 `` request.POST``のAPI)をインタフェースAPIのドキュメントとして追加しました。
  • &quot;静的&quot;ルート機能に関する&quot;URL Dispatch &quot;の説明の章にセクションを追加しました。
  • ドキュメントのHTMLレンダリングに&quot;ピラミッドの新機能1.1 &quot;を追加しました。
  • `` pyramid.authentication.SessionAuthenticationPolicy``にAPIドキュメントを追加しました。
  • `` pyramid.httpexceptions.exception_response``にAPIドキュメントを追加しました。
  • `` pyramid.httpexceptions.exception_response``の説明を含むViewsナレーションの章に&quot;HTTP Exceptions &quot;セクションを追加しました。

特徴

  • 言語のフォールバックのサポートを追加する:特定の領域( `` en_GB``など)を翻訳しようとすると、言語の翻訳に落ちます(つまり `` en``)。これにより、GNU gettextに沿った翻訳動作が行われ、Cの拡張機能を使用すると部分的に翻訳されたテキストが修正されます。

  • 新しい認証ポリシー: `` pyramid.authentication.SessionAuthenticationPolicy``。セッションを使用してクレデンシャルを保存します。

  • `` pyramid.request.Request``オブジェクト( `` request.response``など)の `` response``属性にアクセスすると、新しい `` pyramid.response.Response``オブジェクトが生成されるようになりました。この機能は、主にレンダラで設定されたビューが応答属性を設定する必要がある場合に使用されます。すべてのレンダラは、ルータに返されるレスポンスオブジェクトとして `` request.response``が意味するResponseオブジェクトを使用します。

    `` request.response``は、レンダラーを使用しないビューのコードでも使用できますが、レンダラーが再生されていないときには `` request.response``で生成されるレスポンスオブジェクトを返す必要があります&quot;グローバル&quot;応答ではありません)。

  • 整数やロングは `` pyramid.url.resource_url``や `` pyramid.request.Request.resource_url``に ``要素 ``として渡されます。 `` resource_url(context、request、1,2) ``( ` 1 &quot;と&quot; 2 &quot;が&quot;要素 &quot;である)は、暗黙的に結果の文字列に変換されます。以前は整数またはlongを要素として渡すと、TypeErrorが発生します。

  • `` pyramid_alchemy``ペーストテンプレートは、 `` query.filter_by``ではなく `` query.get``を使用してアイデンティティマップキャッシングをより有効に活用します。

  • `` pyramid_alchemy``ペーストテンプレートにユニットテストが追加されました。

  • `` pyramid.i18n.make_localizer`` APIを追加しました( `` get_localizer`` gutsから抜粋)。

  • NewRequestイベントサブスクライバによって生成された例外は、例外ビューで捕捉できるようになりました。

  • Pyramidが例外ビューからForbidden例外を発生させた理由についての情報を得ることができるようになりました。各在庫承認ポリシー( `` pyramid.interfaces.IAuthorizationPolicy.permits``)の `` permits``メソッドによって返された `` ACLDenied``オブジェクトは、 `` result``属性としてForbidden例外に付加されました。したがって、[禁止された例外]ビューを作成した場合、ACE、ACL、アクセス許可、および要求に含まれるプリンシパルが、たとえば次のように表示されます。 `` context.result.permission``、 `` context.result.acl``などの禁止された例外ビューのロジック内にあります。

  • `` AuthTktAuthenticationPolicy``を設定する際に、 `` timeout``が `` reissue_time``よりも低くならないように明示的にはしないでください(以前の設定では `` ValueError``が発生します。無意味な)。無意味な設定を許可することで、コードを理解しやすくなり、必要なテストが少なくなりました。

  • `` paster pviews``という新しいパスタコマンドが追加されました。このコマンドは、指定されたパスについて一致する可能性のあるビューの概要を出力します。詳細については、説明文の&quot;構成の表示&quot;の章の&quot;特定のURLの一致するビューの表示&quot;を参照してください。

  • Configuratorの `` add_route``メソッドは、 `` static``引数を受け付けるようになりました。この引数が `` True``の場合、要求が処理されたときに追加されたルートは照合のために決して考慮されません。代わりに、 `` route_url``と `` route_path``を使ってURLを生成するだけに便利です。詳細については、URL Dispatchの章の&quot;Static Routes &quot;セクションを参照してください。

  • コンテキスト `` pyramid.interfaces.IExceptionResponse``のデフォルトの例外ビューがデフォルトで登録されるようになりました。これは、 `` pyramid.httpexceptions``( `` HTTPFound``など)からインポートされた例外応答クラスのインスタンスをビューコード内から呼び出すことができることを意味します。呼び出されると、この例外ビューは応答に例外をレンダリングします。

  • `` pyramid.httpexceptions.exception_response``という名前の関数は、HTTP整数ステータスコードを使用してHTTP例外応答オブジェクトを作成するために使用できるショートカットです。

  • Configuratorは、 `` exceptionresponse_view``という名前のキーワード引数を追加できるようになりました。デフォルトでは、この引数には、応答が例外として発生したときに使用されるデフォルトの例外ビュー機能が設定されています。この値に `` None``が渡されると、応答の例外ビューは登録されません。 &quot;None&quot;を渡すと、HTTP例外をPyramid 1.0の例外に戻す動作が返されます(例外はミドルウェアとWSGIサーバに伝播します)。

  • `` pyramid.request.Request``クラスは、 `` pyramid.response.Response``を指す `` ResponseClass``インターフェースを持つようになりました。

  • `` pyramid.response.Response``クラスは `` pyramid.request.Request``を指す `` RequestClass``インターフェースを持っています。

  • レンダラーが使用されていなくても呼び出し可能なPyramidビューから任意のオブジェクトを返すことが可能になりました。返されたオブジェクトの型に適切なアダプタが `` pyramid.interfaces.IResponse``に登録されていれば新しい `` pyramid.config.Configurator.add_response_adapter`` API。 &quot;ピラミッドが応答を見る方法を変更する&quot;というドキュメントのフックの章のセクションを参照してください。

  • Pyramidルータは、WSGIレスポンスを返す際にデフォルトでWebObレスポンスオブジェクトの `` __call__``メソッドを呼び出すようになりました。つまり、WebOb応答オブジェクトの `` conditional_response``機能が適切に動作するようになりました。

  • `` pyramid.request.Request.is_response``という名前の新しいメソッドです。このメソッドは、 `` pyramid.view.is_response``関数の代わりに使用する必要があります。これは廃止予定です。

バグの修正

  • URLディスパッチで使用されるURLパターンマーカーは、カスタム正規表現を指定することができます。例えば、 `` / {foo:d +} というパターンは `/ 12345`(foo == 12345)を` `/ abc``にマッチさせることを意味します。しかし、かっこを使用したパターンマーカのカスタム正規表現は機能しませんでした。たとえば、 `` / {foo:\ d {4}} ``は `` / 1234``と `` / {foo:\ d {1,2}} ``が一致しない / 1``または `` / 11``を使用します。例として与えられた以前の2つのパターンが現在機能するように、内側の括れブラケットの1つのレベルが認識されるようになりました。 https://github.com/Pylons/pyramid/issues/#issue/123も参照してください。
  • AuthTktCookieHelper(https://github.com/Pylons/pyramid/issues/131を参照)によって設定されたCookieのドメイン情報とともにポート番号を送信しないでください。
  • `` pyramid.url.route_path``(ショートカット `` pyramid.request.Request.route_url``メソッド)は、空でない場合はパスの先頭にWSGI SCRIPT_NAMEを追加します(https:// githubを参照)。 com / pylons / pyramid / issues / 135)を参照してください。
  • `` pyramid.testing.DummyRequest``は `` script_name``属性(空の文字列)を持ちます。
  • `` pyramid.url.route_url``または `` pyramid.url.resource_url``(https:// githubを参照)に渡される `` * elements``の ``:@&+ $、 ``を引用符で囲まないでください.com / Pylons / pyramid / issues#issue / 141)。
  • `` pyramid.view.append_slash_notfound_view``(https://github.com/Pylons/pyramid/issues#issue/149を参照)によって発行されたリダイレクトにSCRIPT_NAMEを含めます。
  • `` add_static_view``も内部的にルートファクトリを登録していたので、 `` permission``キーワード引数を含む `` config.add_static_view``で登録された静的ビューは期待どおりに動作しませんでした。ルートファクトリが内部的に登録されているため、ピラミッドパーミッションマシンによってチェックされたコンテキストにはACLが一度もありませんでした。 `` add_static_view``はもはやルートをファクトリに登録しないので、デフォルトルートファクトリが使用されます。
  • `` config.add_static_view``は、 `` config.add_route``に受け取った余分なキーワード引数を渡します(add_static_viewの呼び出しは、 `` pyramid.static.static_view``のルートをフックに追加することとほとんど論理的に同じです)サブパスを持つ)。これにより、カスタムACLで特定の静的ビューを保護するために `` factory = ``を `` add_static_view``に渡すことが可能になります。
  • `` testing.setUp``が実行される前に(* testing.setUp`)ダミーリクエストが作成された場合、` testing.DummyRequest``は間違ったレジストリ(グローバルレジストリ)を self.registry``として使用しました。ローカルレジストリをスレッドローカルスタックにプッシュします)。熱心に属性を割り当てるのではなく、DummyRequestのプロパティとして ` registry``を実装することで修正されました。 https://github.com/Pylons/pyramid/issues/165も参照してください。
  • サブディレクトリに解決された静的ビューを表すURLにアクセスすると、そのサブディレクトリの `` index.html``は適切に処理されません。代わりに、 `` / subdir``へのリダイレクトが発行されます。これは修正され、静的ビュー内の `` index.html``を含むサブディレクトリにアクセスすると、index.htmlが正しく返されます。 https://github.com/Pylons/pyramid/issues/67も参照してください。
  • 静的ビューで発行されたリダイレクトでは、既存の「SCRIPT_NAME」(URLマッピングコンポジットで設定されたものなど)は考慮されませんでした。今彼らはそうする。
  • `` pyramid.wsgi.wsgiapp2``デコレータは、起点リクエストの `` SCRIPT_NAME``を考慮しませんでした。
  • `` pyramid.wsgi.wsgiapp2``デコレータは、トラバーサルを介して見つかったビューを装飾するときにのみ効果的でした。 url-dispatch-matchedビューの一部であった `` PATH_INFO``を無視しました。

廃止

  • `` request.response_ * 属性へのすべての代入を非推奨にしました(例えば `` request.response_content_type = &#39;foo&#39;``は廃止予定です)。レスポンスへの影響をフレームワークで考慮した、割り当て可能なリクエスト属性の代入と突然変異は非難されました: `` response_content_type、 `` response_headerlist``、 `` response_status``、 `` response_charset``、 `` response_cache_for`` 。後でレンダリング機構が検出するためにこれらをリクエストオブジェクトに割り当てるのではなく、 `` request.response``にアクセスして作成したResponseオブジェクトの適切なAPIを使用する必要があります(例えば `` request.response_content_type = &#39;abc&#39; ``は `` request.response.content_type = &#39;abc&#39;``に変更する必要があります)。

  • ビュー関連のパラメータを `` pyramid.config.Configurator.add_route``に渡すことは廃止されました。以前は、コンフィグレータの `` add_route``メソッドに渡された `` view * ``パラメータのセットを使って、ビューをルートに接続することが許可されていました。これは、後で `` add_view``を呼び出す必要性に代わる短縮形でした。たとえば、以下のことを行うには有効でした(しばしば推奨されます):

    config.add_route('home', '/', view='mypackage.views.myview',
                      view_renderer='some/renderer.pt')
    

    `` view * ``引数を `` add_route``に渡すことは、ルートの `` route_name``パラメータを使って `` Configurator.add_view``を介してビューを定義済みのルートに接続することを推奨します。その結果、上記の例は今すぐ綴られるべきです:

    config.add_route('home', '/')
    config.add_view('mypackage.views.myview', route_name='home')
                    renderer='some/renderer.pt')
    

    この廃止は、IRCで見られる混乱を減らし、(最終的に)文書化の負担を軽減するために行われました(https://github.com/Pylons/pyramid/issues/164も参照)。ビュー関連のパラメータが `` Configurator.add_route``に渡されると非推奨警告が発行されるようになりました。

  • &quot;traverser &quot;の `` __call__``メソッド(例えば `` pyramid.traversal.ResourceTreeTraverserのインスタンスのような `` pyramid.interfaces.ITraverser``を実装するオブジェクト)に `` environ``辞書を渡します``) `` request``引数が非推奨警告を出すようになりました。コンシューマーコードは `` request``オブジェクトを渡すべきです。環境を渡すことが許可されているという事実は、 `` repoze.bfg`` 1.1以降、ドキュメンテーション非難されており、この機能は将来のバージョンでは完全に削除されるでしょう。

  • `` __contains__``、 `` __delitem__``、 `` __getitem__``、 `` __iter__``オブジェクトの `` pyramid.request.Request``オブジェクトの以下の(文書化されていない、辞書のような)メソッドは廃止されました。 `` iteritems``、 `` itervalues``、 `` keys``、 `` pop``、 `` __setitem__``、 `` __setitem__``、 `` get_key``、 `` items``、 popitem``、 `` setdefault``、 `` update``、および `` values``のようなものです。これらのメソッドを使用すると、非推奨警告が発行されます。これらのメソッドは、 `` repoze.bfg`` 1.1(BFG 1.0以前ではenvironオブジェクトが期待される要求オブジェクトを現在期待しているコード)の内部互換性のために追加されました。将来のバージョンでは、これらのメソッドは完全に削除されます。

  • pyramid.request.Request.is_response``メソッドを優先して `` pyramid.view.is_response``関数を非推奨にしました。オブジェクトが本当に有効な応答オブジェクトであるかどうかを判断するには、レジストリにアクセスする必要があります。これは、要求属性としてのみ簡単に利用できます。 `` pyramid.view.is_response``関数は、それが削除されるまでは動作しますが、(非常に珍しい)状況下で誤った答えを返すことがあります。

行動の変化

  • デフォルトのMakoレンダラは、式タグ内のすべてのHTMLをエスケープするように設定されました。これは、非正規化された入力をユーザーから表示することによるXSS攻撃を防ぐのに役立ちます。ユーザーのテンプレートでこの動作を元に戻すには、 &#39;n&#39;フィルタを使用して式をフィルタリングする必要があります。たとえば、$ {myhtml | n}。 https://github.com/Pylons/pyramid/issues/193を参照してください。
  • リクエストがレンダラーを使用するビューで使用される場合、 `` response``属性(または&quot;reified &quot; / lazyプロパティ)を持つリクエストオブジェクトを返すカスタムリクエストファクトリが必要になりました。この `` response``属性は `` pyramid.response.Response``クラスのインスタンスでなければなりません。
  • JSONおよび文字列レンダラーファクトリは、 `` request.response_content_type``ではなく `` request.response.content_type``に割り当てられます。
  • 各ビルトインレンダラーファクトリは、レスポンスのコンテンツタイプをレスポンスのデフォルトのコンテンツタイプと比較することによってレスポンスのコンテンツタイプを変更する必要があるかどうかを判断します。コンテンツタイプがデフォルトのコンテンツタイプ(通常 `` text / html``)である場合、レンダラーはコンテンツタイプをJSONおよび文字列レンダラーのそれぞれに対して `` application / json``または `` text / plain``に​​変更します。 。
  • `` pyramid.wsgi.wsgiapp2``は、下流のアプリケーションの `` SCRIPT_NAME``と `` PATH_INFO``を修正する方法を見いだす方法が少しずつ異なります。結果として、それらの値は、下流のアプリケーションの観点から若干異なるかもしれません(例えば、 `` SCRIPT_NAME``は後にスラッシュを持たないでしょう)。
  • 以前は `` pyramid.request.Request``を `` webob.request.Request``から継承し、 `` __getattr__``、 `` __setattr__``、 `` __delattr__``自体を実装してアドホックattrをオーバーライドしましたリクエストの属性が環境内に格納されているWebObの動作。今度は、 `` pyramid.request.Request``オブジェクトは、同じ動作を提供する `` webob.request.Request``の代わりに(より最近の) `` webob.request.BaseRequest``を継承しています。 `` pyramid.request.Request``はもはや独自の `` __getattr__``、 `` __setattr__``、 `` __delattr__``を実装しません。
  • `` pyramid.response.Response``は( `` pyramid.interfaces.IResponse``インターフェースを直接実装するために) `` webob.response.Response``の*サブクラス*になりました。
  • `` pyramid.httpexceptions``(例えば `` HTTPNotFound``)からインポート可能な&quot;例外応答&quot;オブジェクトは、 `` webob.exc``に実際に存在するクラスのインポートエイリアスではなくなりました。代わりに、 `` webob.exc``例外応答オブジェクトをほぼ完全にミラーリングしてエミュレートする独自の例外クラスをモジュール内に定義しました。詳細については、&quot;Design Defense &quot; docセクションの &quot;Pyramidが独自のHTTP例外クラスを使用する&quot;を参照してください。

後方の非互換性

  • PyramidはPython 2.4をサポートしなくなりました。 Pyramid 1.1+を実行するには、Python 2.5以上が必要です。
  • デフォルトでは、Pyramidルータは、 `` pyramid.interfaces.IResponse``インタフェースを実装するために、ビュー呼び出し可能オブジェクトから返された応答オブジェクトを期待しています。このインタフェースのPyramid 1.0バージョンとは異なり、IResponseを実装するオブジェクトは、現在、 `` environ``と `` start_response``を受け入れ、 `` app_iter`` iterableを返す `` __call__``メソッドを定義しなければなりませんもの。以前は、3つのWebOb `` app_iter``、 `` headerlist``、および `` status``属性をレスポンスとして持つオブジェクトを返すことができました。これは後方互換性がありません。 IRISponseにアダプターを登録することで、ビュー呼び出し可能オブジェクトから戻ってきたオブジェクトの型から下位互換性を取り戻すことができます。 &quot;ピラミッドが応答を見る方法を変更する&quot;というドキュメントのフックの章のセクションを参照してください。
  • `` pyramid.interfaces.IResponse``インターフェースは、より広範囲になりました。これまでは `` app_iter``、 `` status``、 `` headerlist``だけを定義していました。これは基本的に `` webob.Response`` APIを直接ミラーリングすることを意図しています。これは多くのメソッドと属性を持っています。
  • `` HTTPFound``、 `` HTTPMultipleChoices``、 `` HTTPMovedPermanently``、 `` HTTPSeeOther``、 `` HTTPUseProxy``、および `` HTTPTemporaryRedirect``という名前の `` pyramid.httpexceptions``クラスは、 `` detail``ではなく `` location``を最初の位置引数として使用します。これは、pyramid.httpexceptions.HTTPFound(location = &#39;http // foo&#39;) ``を返すのではなく、 `` pyramid.httpexceptions.HTTPFound( &#39;http:// foo&#39;) ``を返すなど、後者はもちろん作業を続けるでしょう)。

依存関係

  • Pyramidは、テストがそのリリースのバグ修正に依存するため、WebOb&gt; = 1.0.2に依存します:&quot;SCRIPT_NAME`` &quot;がない状態でのWSGI環境の処理を修正しました。 (WebOb 1.0.2と1.0.3は実質的にブラウンバックのリリースであったため、実際には1.0.4以上のバージョンを使用しているはずです)。

1.0(2011-01-30)

ドキュメンテーション

  • ZODB Wikiチュートリアルのバグを修正しました( `` setup.py``内の&quot;models &quot;のステップで `` docutils``に依存しません)。
  • `` registerDummySecurityPolicy``、 `` registerResources``、 `` registerModels``、 `` registerEventListener``、 `` registerTemplateRenderer``、 `` registerDummyRenderer``、 `` API`` APIの `` pyramid.testing`` APIに関するAPIドキュメントを削除しました。 registerAttility`、 `` registerAdapter``、 `` registerSubscriber``、 `` registerRoute``、 `` registerSettings``のように、
  • &quot;ZODOでZODBを使用する&quot;と&quot;repoze.catalogをピラミッド内でtutorialsの中からコアドキュメントとPyramidチュートリアルサイト(http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/)に移動しました。 。
  • WSGI環境に `` __del__``でオブジェクトをジャムするのではなく、 `` request.add_finished_callback``を使うようにURL Dispatch章の &quot;Request After After a Request&quot;セクションを変更しました。
  • `` add_route`` APIドキュメントの重複をURL Dispatchの説明の章から削除します。
  • `` pyramid.view.view_config`` APIドキュメントのAPIとNarrativeドキュメンテーションの重複を削除するには、 `` pyramid.config.add_view``ドキュメンテーションとナレーションの章のドキュメントを参照してください。
  • ドキュメンテーションのナレーション部分に複製されたいくつかのAPIドキュメントを削除
  • SQLAlchemy + URLディスパッチwikiチュートリアルの&quot;全般的な認証の流れ&quot;を削除しました(印刷物の問題が原因です)(Pyramidチュートリアルのサイトに移動)。

バグの修正

  • `` pyramid.testing``のBFG-1.2 APIは廃止予定の警告を適切に出力するようになりました。
  • ZODBテンプレートのWSGIパイプラインに `` egg:repoze.retry#retry``ミドルウェアを追加しました(通常の操作で発生するZODB競合エラーの再試行)。
  • `` is_response``の重複した実装を削除しました。競合する2つの実装が存在しました。一つは `` pyramid.config``に、もう一つは `` pyramid.view``です。 `` pyramid.view``で定義されたものは、 `` pyramid.config``で内部的に使われ、引き続きAPIとして宣伝されています。

1.0b3(2011-01-28)

バグの修正

  • パーステンプレート/チュートリアルテンプレートの著作権記号の代わりに©を使用すると、カットアンドペーストして非UTF8形式に保存する人々の利益が得られます。
  • `` pyramid.view.append_slash_notfound_view``は、リダイレクト間でGETクエリパラメータを保存するようになりました。

ドキュメンテーション

  • `` set_default_permission``に関連する文書を作成してください:デフォルトの権限が例外ビューも保護することを明示してください。
  • パスタテンプレートとチュートリアルでは、HTMLテンプレートのタブの代わりにスペースを使用するようになりました。

1.0b2(2011-01-24)

バグの修正

  • すべてのペースターテンプレートによって生成された `` production.ini``は、SQLAlchemy文のロギングやその他の不適切な出力を防ぐ有効なロギングレベルWARNを持つようになりました。
  • `` pyramid_routesalchemy``と `` pyramid_alchemy``のペーストテンプレートの `` production.ini``には `` sqlalchemy``ロガーセクションがなく、 `` paster serve production.ini``が動作しません。
  • `` pyramid_routesalchemy``と `` pyramid_alchemy``のペーストテンプレートは、 `` {{project}} 変数を使用すべき場所で `` {{package}} ``変数を使っていました。例えば ​​ paster create -t​​. pyramid_routesalchemy Dibbus``は、 `` paster serve development.ini``がその結果に対して使われたときに開始できません。 https://github.com/Pylons/pyramid/issues/#issue/107を参照してください。
  • `` pyramid.renderers.RendererHelper``の `` render_view``メソッドはレンダラーに `` renderer_info``の値を渡しました。これは辞書の代わりに `` RendererHelper``のインスタンスを渡します。これは他の用法と一貫しています。 https://github.com/Pylons/pyramid/issues#issue/106を参照してください。
  • AuthTktAuthenticationPolicyのトークン( `` reissue_time`` &lt;`` timeout`` / `` max_age``)を再発行するように設定されているときに、それを破るバグが `` pyramid.authentication.AuthTktCookieHelper``に存在しました。症状: `` ValueError:( &#39;無効なトークン%r&#39;、 &#39;&#39;) ``https://github.com/Pylons/pyramid/issues#issue/108を参照してください。

1.0b1(2011-01-21)

特徴

  • AuthTktAuthenticationPolicyは、 `` pyramid.security.remember``を介して `` tokens``パラメータを受け付けるようになりました。値は一連の文字列でなければなりません。トークンはauth_tkt &quot;tokens &quot;フィールドに置かれ、auth_tktクッキーに返されます。
  • AuthTktAuthenticationPolicyに `` wild_domain``引数を追加します。デフォルトは `` True``です。 `` False``に設定されている場合、ワイルドカードドメインを持つクッキーを設定するポリシーの機能は無効になります。
  • 各パスタテンプレートに `` MANIFEST.in``ファイルを追加してください。 https://github.com/Pylons/pyramid/issues#issue/95を参照してください。

バグの修正

  • `` testing.setUp``はレジストリに `` settings``属性を追加するようになりました(設定なしでレジストリが渡されたときと作成されたときの両方)。
  • `` testing.setUp``関数は、 `` settings``引数をとります。これは辞書でなければなりません。その値は、返された `` config``オブジェクトで `` config.registry.settings``として利用可能になります。

ドキュメンテーション

  • ドキュメントのHTMLレンダリングに&quot;What&#39;s New in Pyramid 1.0 &quot;の章を追加しました。
  • 合併したcaseman-master Narrative編集枝、多くの文言の修正と拡張。
  • チャプターのテストの章で `` chameleon_zpt`` API呼び出しを表示する非推奨の例を修正しました。
  • `` add_directive`` &quot;セクションを介してアドバンストコンフィグレーションの説明の章に&quot;コンフィグレータへのメソッドの追加 &quot;を追加しました。
  • `` add_finished_callback``、 `` add_response_callback``、 `` route_path``、 `` route_url``、 `` static_url``メソッドを `` pyramid.request.Request`` APIドキュメントに追加してください。
  • Makoテンプレート内のI18Nを「国際化とローカリゼーション」の章で使用する方法についてのドキュメントを(最小限)追加してください。
  • &quot;フォーム&quot;章の内容を&quot;Views &quot;の章に戻します。私はそれを置くより良い場所を考えることができません。
  • `` IAuthorizationPolicy``のインターフェイス文書が少し改良されました。
  • 「URLディスパッチ」の章内のURLディスパッチ置換マーカーでカスタム正規表現の使用法を最小限に説明します。

廃止

  • `` pyramid.view.view_config``(下位互換性shim)に `` pyramid.view.bfg_view``エイリアスを使うと、非推奨警告が発行されるようになりました。

後方の非互換性

  • `` testing.setUp``を使うと、ISettingsユーティリティが副作用として登録されるようになりました。 queryAdapterを介して `` testing.setUp``の後にこのユーティリティを問い合わせるテストコードは `` None``の戻り値を期待します。このコードを変更する必要があります。
  • `` pyramid.exceptions.Forbidden``エラーが発生すると、そのステータスコードは `` 403 Forbidden``になります。 `` repoze.bfg``との下位互換性のために以前は `` 401 Unauthorized``でした。この変更により、デフォルトで `` 401 Unauthorized``を傍受し、 `` 403 Forbidden``を通過させる `` repoze.who``でPyramidのユーザに問題が発生します。これらのデプロイメントでは、 `` 403 Forbidden`にも対応するために `` repoze.who``を設定する必要があります。
  • `` pyramid.session.UnencyrptedCookieSessionFactory``に対する `` cookie_on_exception``パラメータのデフォルト値は、 `` True``になりました。つまり、ビューコードによって例外が発生し、セッションが変更された場合、クッキーが返されます。以前のデフォルト値は `` False``でした。

ペースターテンプレート

  • `` pyramid_zodb``、 `` pyramid_routesalchemy``、 `` pyramid_alchemy``のペーストテンプレートは `` development.ini``で `` repoze.tm2``トランザクションマネージャを設定するときにデフォルトの &quot;コミット拒否&quot;フックを使用するようになりました。 `。これにより、応答ステータスコードが400または500の範囲内にあるときにトランザクションがコミットされるのを防止します。 http://docs.repoze.org/tm2/#using-a-commit-vetoも参照してください。

1.0a10(2011-01-18)

バグの修正

  • URLディスパッチは大括弧の中で使われるときに正規表現マッチで現れる `` * * ``や `` * ``を適切に処理するようになりました。問題#90を解決します。

後方の非互換性

  • Configuratorの `` add_handler``メソッドがPyramidコアから削除されました。ハンドラは、PyPIからダウンロードできる `` pyramid_handlers``パッケージの機能になりました。パッケージのドキュメントはhttp://docs.pylonsproject.org/projects/pyramid_handlers/en/latest/から入手できます。これは、このメソッドを再利用するために `` main``ブロックに構成文を追加する方法を説明しています。また、 `` pyramid_handlers``に `` install_requires``の依存関係を `` setup.py``ファイルに追加する必要があります。
  • Configuratorの `` load_zcml``メソッドがPyramidコアから削除されました。 ZCMLの読み込みは、PyPIからダウンロードできる `` pyramid_zcml``パッケージの機能となりました。パッケージのドキュメントは、http://docs.pylonsproject.org/projects/pyramid_zcml/en/latest/から入手できます。これは、このメソッドを再利用するために `` main``ブロックに構成文を追加する方法を説明しています。また、 `` pyramid_zcml``に `` install_requires``の依存関係を `` setup.py``ファイルに追加する必要があります。
  • `` pyramid.includes``サブパッケージは削除されました。使用するZCMLファイルにはパッケージ `` ​​pyramid.includes``(例えば `` ` <include package="pyramid.includes"/> `` pyramid_zcml``パッケージをインクルードする必要があります(例えば `` ` <include package="pyramid_zcml"/> ``)。
  • `` pyramid.view.action``デコレータはPyramidコアから削除されました。ハンドラは、現在、 `` pyramid_handlers``パッケージの機能です。 `` pyramid_handlers import action``のように、 `` pyramid_handlers``からインポートする必要があります。
  • ``ハンドラ `` ZCMLディレクティブは削除されました。これは `` pyramid_handlers``パッケージの機能です。
  • `` pylons_minimal``、 `` pylons_basic``、 `` pylons_sqla``のペーストテンプレートは削除されました。 Pylons-esque開発の一般的な置き換えとして、 `` pyramid_sqla``(PyPIから入手可能)を使用してください。
  • `` make_app``関数は `` pyramid.router``モジュールから削除されました。これは `` pyramid_zcml``パッケージ内での生活を続けています。これにより、 `` pyramid.router``モジュールにはAPI関数がなくなります。
  • デプロイメント設定(Pyramidの `` main``関数に渡される `` ** settings``内の)内の `` configure_zcml``の設定は意味を持ちません。

特徴

  • `` pyramid.testing.setUp``と `` pyramid.testing.tearDown``は廃止されました。これで、コンフィグレータの直接作成に代わって、テストコンフィグレーションのための標準的なセットアップとティアダウンAPIになりました。これは、今後のConfiguratorの廃止を防ぐファサードを提供するように設計された変更です。
  • `` pyramid.testing.DummyRequest``に `` charset``属性を追加します(無条件に `` UTF-8``)。
  • configuratorに `` add_directive``メソッドを追加すると、フレームワークエクステンダがコンフィグレータにメソッドを追加できます(ala ZCMLディレクティブ)。
  • `` Configurator.include``が引数として* module *を渡されたとき、デフォルトではそのモジュール内で `` includeme``という名前の呼び出し可能ファイルを見つけようとします。これにより、 `` some.module &#39;&#39;の中のインクルード関数が有効である限り、 `` config.include( &#39;some.module.somefunc&#39;) ``ではなく `` config.include( &#39;some.module&#39;) ``を使用することができます``は `` includeme``という名前です。
  • `` bfg2pyramid``スクリプトは、 `` repoze.bfg.includes``をパッケージ属性として持つZCMLインクルードタグを `` pyramid_zcml``に変換します。例えば、 `` <include package="repoze.bfg.includes"> ``は `` ` <include package="pyramid_zcml"> ``

ペースターテンプレート

  • すべてのペーストテンプレートは、 `` tests.py``モジュール内にConfiguratorを手動で作成するのではなく、 `` pyramid.testing.setUp``と `` pyramid.testing.tearDown``を使用します。上記の機能。
  • `` starter_zcml``のペーストテンプレートは `` pyramid_zcml``パッケージに移動されました。

ドキュメンテーション

  • ウィキとwiki2のチュートリアルでは、上記の機能の決定に従って、「手作業で」コンフィグレータを作成するのではなく、 `` pyramid.testing.setUp``と `` pyramid.testing.tearDown``を使用するようになりました。
  • &quot;Testing &quot;の説明の章では、Configuratorの作成の代わりに `` pyramid.testing.setUp``と `` pyramid.testing.tearDown``と `` Configurator.begin() ``と `` Configurator.end() ) ``
  • &quot;Renderers &quot;章内の `` request.override_renderer``属性を&quot;実行時にレンダリングを上書きする&quot;という節で文書化してください。
  • &quot;Declarative Configuration &quot;の説明の章は削除されました( `` pyramid_zcml``パッケージに移動されました)。
  • 物語の章の中のZCMLへの参照は、削除されたり、 &quot;pyramid_zcml&quot;の場所にリダイレクトされました。

廃止

  • 次のAPI関数のインポートに関連する非推奨警告が追加されました: `` pyramid.traversal.find_model``、 `` pyramid.traversal.model_path``、 `` pyramid.traversal.model_path_tuple``、 `` pyramid.url.model_url ``。 deprecation警告によって出された命令は、開発者にこれらのメソッドのスペルを `` resource``に相当するものに変更するよう指示します。これは、1.0a7で実行された&quot;モデル&quot;から &quot;&quot; &quot;リソース&quot;への質量コンセプトの変更の結果です。

1.0a9(2011-01-08)

バグの修正

  • `` proutes``コマンドは、印刷のためにビューを解決するのが難しかったので、例外的なルートファクトリに遭遇したときに例外が発生しました。ビューを解決しようとするのではなく、表示できない場合は、 `` <unknown> ``
  • `` self`引数は、 `` Session``インターフェースシグネチャの新しいメソッドに含まれていました。これにより `` pyramid_beaker``テストが失敗しました。
  • 下位互換性のために `` pyramid.traversal.resource_path_tuple``の別名として `` pyramid.traversal.model_path_tuple``を読んでください。

特徴

  • 新しいAPI「pyramid.url.current_route_url``を追加します。このAPIは、&quot;現在の&quot;ルート(もしあれば)とそのmatchdict値に基づいてURLを計算します。
  • `` config.add_view``は、 `` decorator``キーワード引数を受け付けます。これは、レジストリに追加される前に呼び出し可能なビューをデコレートする呼び出し可能です。
  • ハンドラクラスが `` __action_decorator__``属性(通常はclassmethodまたはstaticmethod)を提供する場合、それをそのハンドラの各ビュー登録のデコレータとして使用します。
  • `` pyramid.interfaces.IAuthenticationPolicy``インターフェースは `` unauthenticated_userid``メソッドを指定するようになりました。このメソッドは、オブジェクトキャッシングをサポートしない永続ストレージを使用しているユーザーと、要求属性として&quot;ユーザーオブジェクト&quot;を作成するユーザーが必要とする重要な最適化をサポートします。
  • 新しいAPIが `` unauthenticated_userid``という名前の `` pyramid.security``モジュールに追加されました。このAPI関数は、有効なセキュリティポリシーの `` unauthenticated_userid``メソッドを呼び出します。
  • `` unauthenticated_userid``メソッドが `` pyramid.config.Configurator.testing_securitypolicy``で返されたダミー認証ポリシーに追加されました。これは、ダミー認証ポリシーの `` authenticated_userid``メソッドと同じものを返します。
  • `` pyramid.authentication.AuthTktCookieHelper``はAPIになりました。このクラスは、認証Cookie設定の仕組みを助けるために、サードパーティの認証ポリシー開発者が使用できます。
  • Configuratorの新しいコンストラクタ引数: `` default_view_mapper``。代わりのビュー呼び出し規則を持つシステムを作成すると便利です。ビュー・マッパーは、ビュー・コール可能オブジェクトとして使用されるオブジェクトに、任意の引数リストと任意の結果を持たせることができます。 `` default_view_mapper``として渡されたオブジェクトは、 `` pyramid.interfaces.IViewMapperFactory``インタフェースを実装する必要があります。
  • Configuratorに `` set_view_mapper`` APIを追加してください。 Configuratorコンストラクタに `` default_view_mapper``を渡すのと同じ結果を返します。
  • `` config.add_view``は、 `` mapper``キーワード引数を受け取ります。これは、 `` None``、Pythonの点線の名前を表す文字列、 `` IViewMapperFactory``のオブジェクトのいずれかでなければなりません。この機能は&quot;民間人&quot;には役に立ちませんが、拡張機能の作者にのみ有効です。
  • ビューの登録中に提供された静的レンダラが、以前に登録されたレンダラの名前でなければならない `` override_renderer``という名前のリクエスト属性を介してリクエスト時にオーバーライドされるようにします。既存のレンダリングビューを使って&quot;遍在する&quot; RPCを提供するのに便利です。
  • `` pyramid.testing.DummyRequest``のインスタンスは、ほとんどが辞書である `` session``オブジェクトを持っていますが、flashとCSRFのための他のセッションAPIメソッドも実装しています。

後方の非互換性

  • `` pyramid.interfaces.IAuthenticationPolicy``インターフェースは、ポリシー実装が `` unauthenticated_userid``メソッドを実装しなければならないように指定しているので、サードパーティのカスタム認証ポリシーはすべてこのメソッドを実装する必要があります。ただし、 `` pyramid.security.unauthenticated_userid``という名前のグローバル関数が呼び出されたときにのみ呼び出されるので、呼び出していなければ何の問題も気づかないでしょう。
  • `` pyramid.interfaces.ISession.get_csrf_token``は、セッションにすでに存在していない場合(以前はNoneを返す)、実装が* new *トークンを返さなければならないようにしました。内部セッションの実装が変更されました。

ドキュメンテーション

  • (弱い)&quot;CMFアプリケーションをPyramidに変換する&quot;チュートリアルは、チュートリアルのセクションから削除されました。それは `` pyramid_tutorials`` Githubリポジトリに移されました。
  • &quot;リソースの場所とビューの参照&quot;の章は、Rob Millerの&quot;Much Ado About Traversal &quot;(元々http://blog.nonsequitarian.org/2010/much-ado-about-htmlで公開されています)トラバーサル/)。
  • 多くのマイナーな言い回しとリファクタリング(Casey Duncanのドキュメントフォークを統合し、一般的な編集に取り組んでいます)。
  • フックの説明の章に新しいビューマッパー機能の(弱い)記述を追加しました。
  • ビューを2:ビュー呼び出しとビュー構成に分割する。
  • View Callablesの後、View Configurationの前に、レンダラーとテンプレートの章を並べ替えます。
  • セッションオブジェクトのマージ、クロスサイトリクエスト偽造、およびFlash Messagingの章を1つのセッションの章にまとめます。
  • WikiとWiki2のチュートリアルには、より良いCSSとグラフィックがあります。

内部

  • &quot;ビュー派生&quot;コードは、多数のスタンドアロン関数(ビューマッパーリファクタリングの副作用)ではなく、一連のクラスに分解されるようになりました。
  • `` pyramid.renderer.RendererHelper``クラスは、デフォルトのビューマッパー(ビューマッパーリファクタリングの副作用)によって使用される `` render_view``メソッドを増やしました。
  • &quot;view deriver &quot;に `` renderer``として渡されたオブジェクトは、辞書(ビューマッパーリファクタリングの副作用)ではなく `` pyramid.renderers.RendererHelper``のインスタンスになりました。
  • `` pyramid.chameleon_text``の&quot;page template &quot;として使われたクラスは、カメレオンの組み込みバージョンを使うのが優先して削除されました。
  • レジストリに登録されたビュー呼び出し可能ラッパーには、元のビュー呼び出し可能な(またはクラス)を参照する `` __original_view__``属性が含まれています。
  • 以前に `` _get_userid``と命名されたすべての内部認証ポリシー実装の(非API)メソッドは、現在は `` unauthenticated_userid``という名前になり、APIメソッドに昇格しました。このメソッドをオーバーライドした場合は、代わりに `` unauthenticated_userid``としてオーバーライドする必要があります。
  • _map_viewというconfig.pyの(非API)機能を削除します。

1.0a8(2010-12-27)

バグの修正

  • `` registry``という名前は、IPythonの `` paster pshell``環境では利用できませんでした。

特徴

  • リソースが `` __resource_url__``メソッドを実装している場合、 `` pyramid.url.resource_url``関数を呼び出してURLを生成し、デフォルトロジックをオーバーライドした結果として呼び出されます。 「リソースの説明」の章の新しい「リソースのURLの生成」セクションを参照してください。
  • &quot;Flash Messaging &quot; Narrativeドキュメンテーションの章で説明されているように、フラッシュメッセージを追加しました。
  • &quot;クロスサイトリクエスト偽造攻撃の防止&quot;という説明の章で説明されているように、CSRFトークンの生成が追加されました。
  • ビュー関連の引数が存在し、 `` view``引数が渡されなければ、設定中に例外を発生させてadd_routeへの `` view``と `` view_permission``引数がどのように働くのか誤解を避けてください。
  • ルーティングテーブルの要約を表示する `` paster proute``コマンドを追加してください。 &quot;URL Dispatch &quot;の章 &quot;&quot;すべてのアプリケーションルートの表示&quot;の説明文のセクションを参照してください。

ペースターテンプレート

  • `` pyramid_zodb`` PasterテンプレートはもはやZCMLを使用しません。代わりに、それはスキャンに基づいています。

ドキュメンテーション

  • リソースの説明の章(&quot;__resource_url__&quot;を使ったURL生成のオーバーライドに関する情報を含む)に&quot;リソースのURLを生成する&quot;セクションを追加しました。
  • 「リソースへのパスの生成」セクションを「リソースの説明」の章に追加しました。
  • リソースの説明の章に&quot;パス別リソースの検索&quot;セクションを追加しました。
  • リソースナレーションの章に&quot;リソースの系統を取得する&quot;を追加しました。
  • &quot;リソースが別のリソースのリネージにあるかどうかをリソースの説明の章に追加する&quot;を追加しました。
  • リソースの説明の章に&quot;ルートリソースを見つける&quot;を追加しました。
  • リソースの説明の章に&quot;リネージュのクラスまたはインターフェイスを持つリソースを見つける&quot;を追加しました。
  • &quot;Flash Messaging &quot;ナレーションドキュメントの章を追加しました。
  • &quot;Cross-Site Request Forgery Attacksの防止&quot;と題された説明の章が追加されました。
  • `` pyramid_zodb`` Pasterテンプレートの変更に基づいて&quot;ZODB + Traversal Wiki Tutorial &quot;を変更しました。
  • 設定の競合、2段階設定、 `` include``と `` commit``をどう扱うかを文書化した&quot;Advanced Configuration &quot;ナレーションの章を追加しました。
  • `` pyramid.view.static``のAPIドキュメントのレンダリングを修正しました。
  • ディフェンスのドキュメントを作成するには、&quot;ピラミッドはそれを行う方法の1つ以上を提供する&quot;を追加します。
  • 変更された静的アセット&quot;ナレーションの章:&quot; name &quot;はURLでない限りプレフィックスを表し、URLディスパッチのルート相対スタティックビューフォールバックの例を追加し、単純なビューを作成する例を追加しましたファイルの本体。
  • 「Hooks」の章の「Declarative Configuration」の章にZCMLの使用法を移してください。
  • &quot;静的資産&quot;の章を&quot;資産&quot;の章にマージします。
  • &quot;URL Dispatch &quot;章の&quot;すべてのアプリケーションルートの表示&quot;( &quot;paster proutes&quot;コマンドの場合)にナレーション文書セクションを追加しました。

1.0a7(2010-12-20)

用語の変更

  • 以前は&quot;モデル&quot;として知られていたピラミッドの概念は、現在 &quot;リソース&quot;として知られています。結果として:

    • 次のAPI変更が行われました:

      pyramid.url.model_url ->
                        pyramid.url.resource_url
      
      pyramid.traversal.find_model ->
                        pyramid.url.find_resource
      
      pyramid.traversal.model_path ->
                        pyramid.traversal.resource_path
      
      pyramid.traversal.model_path_tuple ->
                        pyramid.traversal.resource_path_tuple
      
      pyramid.traversal.ModelGraphTraverser ->
                        pyramid.traversal.ResourceTreeTraverser
      
      pyramid.config.Configurator.testing_models ->
                        pyramid.config.Configurator.testing_resources
      
      pyramid.testing.registerModels ->
                        pyramid.testing.registerResources
      
      pyramid.testing.DummyModel ->
                        pyramid.testing.DummyResource
      
    • 以前は&quot;モデル&quot;を参照していたすべてのドキュメントは、&quot;リソース&quot;を参照しています。
    • `` starter``と `` starter_zcml``のペーストテンプレートに `` models.py``モジュールの代わりに `` resources.py``モジュールが追加されました。
    • さまざまなAPIの位置引数名が `` model``から `` resource``に変更されました。

    下位互換性のシムは、すべての場合に適所に残っています。彼らは&quot;永遠に&quot;働き続けるでしょう。

  • 以前は&quot;リソース&quot;として知られていたピラミッドの概念は、現在 &quot;資産&quot;として知られています。結果として:

    • 以前は `` pyramid.resource``として知られていた(非API)モジュールは `` pyramid.asset``と呼ばれています。

    • 以前は&quot;リソース指定&quot;を参照していたすべてのドキュメントが&quot;資産指定&quot;を参照しています。

    • 次のAPI変更が行われました:

      pyramid.config.Configurator.absolute_resource_spec ->
                        pyramid.config.Configurator.absolute_asset_spec
      
      pyramid.config.Configurator.override_resource ->
                        pyramid.config.Configurator.override_asset
      
    • 以前は `` resource``として知られていたZCMLディレクティブは `` asset``と呼ばれています。

    • 以前は `` BFG_RELOAD_RESOURCES``(envvar)または `` reload_resources``(configファイル)として知られていた設定は、それぞれ `` PYRAMID_RELOAD_ASSETS``と `` reload_assets``として知られています。

    下位互換性のシムは、すべての場合に適所に残っています。彼らは&quot;永遠に&quot;働き続けるでしょう。

バグの修正

  • すべてのテストを( `` python setup.py nosetests``を介して間接的にではなく)直接 `` nosetests``コマンドで直接実行することができます。
  • スキャン中に構成の競合が発生すると、競合の例外は、競合の原因となったデコレータ情報を表示するようになりました。

特徴

  • マッチしたルート(matchdictと述語を含む)を記録する `` debug_routematch``設定を追加しました。
  • `` registry``という名前はデフォルトで `` pshell``環境で利用できるようになりました。これはアプリケーションレジストリオブジェクトです。

環境

  • 接頭辞 `` BFG_``を使用していたすべての環境変数は、 `` PYRAMID_``の接頭辞になりました(例えば `` BFG_DEBUG_NOTFOUND``は `` PYRAMID_DEBUG_NOTFOUND``です)

ドキュメンテーション

  • urldispatchナレーション文書の章に&quot;Debugging Route Matching &quot;セクションを追加しました。
  • `` PYRAMID_DEBUG_ROUTEMATCH`` envvarと `` debug_routematch``設定ファイルの設定をEnvironment Narrative Docs章に追加しました。
  • &quot;Project &quot;の章を `` paster pshell``の使用を拡張するために少し変更しました。
  • Jythonのユーザーは、「インストール」の説明の章でJinja2ではなくMakoに指示してください。
  • &quot;モデル&quot;から&quot;リソース&quot;、&quot;リソース&quot;から&quot;資産&quot;への用語の名前変更をサポートする多くの変更。
  • テストの説明の章に `` WebTest``機能テストの例を追加しました。
  • 一般的な要求(URLディスパッチ、トラバース)によるチャプター順の並べ替え。ビューの章の後にハイブリッドの章を置く。
  • 物語のドキュメンテーションの&quot;Views &quot;章から&quot;Renderers &quot;を独自の章として分割します。

ペースターテンプレート

  • すべてのペーストテンプレートに `` debug_routematch = false``を追加しました。

依存関係

  • Venusian&gt; = 0.5(スキャン競合例外装飾用)に依存します。

1.0a6(2010-12-15)

バグの修正

  • 1.0a5は `` pyramid.config.Configurator.scan``が `` config.scan( &#39;packagename&#39;)とは対照的に、 `` package``引数( `` config.scan() `` ) ``。症状は次のとおりです:廃止予定のピラミッド関数とクラスのインポートについてのコンソールへの非推奨警告の多く、 `` view_config``デコレータで装飾されたビュー呼び出し可能項目の非検出。
  • テストは現在Windows上で行われます(バグは見つかりませんが、テストスイート内のいくつかのテストではファイル名にUNIXパスセグメントが仮定されています)。

ドキュメンテーション

  • ZODB + Traversal Wikiチュートリアルでは、「pyramid_zodb」チュートリアルで生成されたビュー呼び出し可能関数が呼び出し可能な1つのビューを使用していたため、失敗するテストを実行するように指示しましたが、サンプルコードでは、2引数呼び出しを使用していました。
  • `` pyramid_zodb``で生成されたものと一致するように、すべてのステップのZODB + Traversalチュートリアルsetup.pyを更新しました。
  • &quot;Models &quot;章の `` repoze.bfg.traversalwrapper``への参照を修正してください(代わりに `` pyramid_traversalwrapper``を参照)。

1.0a5(2010-12-14)

特徴

  • ``ハンドラ `` ZCMLディレクティブを追加してください。このディレクティブは `` pyramid.configuration.add_handler``と同じことをします。
  • `` pyramid.config``という名前の新しいモジュールが追加されました。それは古い `` pyramid.configuration``モジュールの任務を包含しています。
  • 新しい `` pyramid.config.Configurator`クラスには、以前の `` pyramid.configuration.Configurator``クラスがしなかったAPIメソッドがあります: `` with_context``(クラスメソッド)、 `` include``、 ``アクション`、` `commit``のようなものです。これらの方法は、必須のアプリケーション拡張性のために存在します。
  • `` pyramid.testing.setUp``関数は、 `` autocommit``キーワード引数を受け付けます。デフォルトは `` True``です。 `` False``が渡された場合、 `` setUp``によって返されるConfigオブジェクトは、自動コミットされないConfigオブジェクトになります。
  • すべてのペースターテンプレートにロギング設定を追加します。
  • `` pyramid_alchemy``、 `` pyramid_routesalchemy``、 `` pylons_sqla``のペーストテンプレートはそれぞれ、 `` .ini``ファイルとPythonコードで慣用的なSQLAlchemy設定を使用します。
  • `` pyramid.testing.DummyRequest``にはクラス変数 `` query_string``があります。デフォルトは空文字列です。
  • NotImplementedErrorをキャッチし、django.utilsからsimplejsonをインポートすることにより、GAE上のjsonのサポートを追加します。
  • Makoレンダラは、 `` mako.module_directory``のリソース指定を受け付けるようになりました。
  • 新しいブール値のMako設定変数 `` mako.strict_undefined``。 `Makoのコンテキスト変数<http://www.makotemplates.org/docs/runtime.html#context-variables>その意味のために `_。

依存関係

  • Mako 0.3.6+に依存しています(これには `` strict_undefined``機能が必要です)。

バグの修正

  • `` paster pshell``セッションの中からConfiguratorを作成するときには、 `` package``は実際には必要ないものの、 `` package``引数を渡さなければなりませんでした。 `` package``を渡さなかった場合、 `` Pyramid.path.caller_module``関数から出てくる `` KeyError: &#39;__name __&#39; ``のようなエラーを受け取ります。これは修正されました。
  • `` pyramid_routesalchemy``ペーストテンプレートのユニットテストは失敗しました( `` AssertionError: &#39;SomeProject&#39;!= &#39;someproject&#39;``)。これは修正されました。
  • 既定のレンダラーが機能するようにします(レンダラーファクトリは名前なしで登録されます。ビューは特定のレンダラーに名前を付けない限りすべてのビューでアクティブです)。
  • Makoレンダラは `` mako.imports``、 `` mako.default_filters``、 `` mako.imports``の設定をリストに正しく戻さなかった。
  • Makoレンダラーは、 `` mako.error_handler``の設定をドット付きの名前から呼び出し可能なものに正しく変換しませんでした。

ドキュメンテーション

  • https://github.com/caseman/pyramid(「モデル」の説明の章まで)のナレーション文書の章に、多くの言葉遣い、読みやすさ、正確さの変更を加えました。
  • &quot;サンプルアプリケーション&quot;セクションは、repoze.bfgの起源パッケージから移植されたCluegun、Shootout、およびVirginiaサンプルアプリケーションの存在を記録するように変更されました。
  • SQLAlchemy + URLDispatchチュートリアルを更新し、 &quot;pyramid_routesalchemy``テンプレートへの変更を統合しました。
  • Interfaces APIの章に `` pyramid.interfaces.ITemplateRenderer``インターフェースを追加してください( `` implementation() ``メソッドを持っています、カメレオンのマクロを使うときに使う必要があります)。
  • プロジェクト物語のドキュメンテーションの章(モジュールをパッケージに変換することについて説明する)に&quot;パッケージ構造の変更&quot;セクションを追加してください。
  • ZCMLセクションの新しい `` handler`` ZCMLディレクティブのためのドキュメントが追加されました。

廃止

  • `` pyramid.configuration.Configurator``は廃止予定です。 `` pyramid.config.Configurator``を使い、コンストラクタ `` autocommit = True``を渡してください。 `` pyramid.configuration.Configurator``エイリアスは、すべてのアプリケーションが使用しているので、長い間存続しますが、インポートによって非推奨警告が発行されるようになりました。 `` pyramid.config.Configurator``クラスは `` pyramid.configuration.Configurator``クラスと同じAPIを持っています。デフォルトでは非自動コミット*コンフィグレータですが、置き換えられることを意味します。現在廃止された `` pyramid.configuration.Configurator``は、設定メソッドが呼び出されるたびに自動的にコミットします。

    `` pyramid.configuration``モジュールは残っていますが、非推奨です。代わりに `` pyramid.config``を使用してください。

1.0a4(2010-11-21)

特徴

  • URL Dispatchでは、置き換えマーカーを `` / ``の直後ではなく、パターン内のどこにでも配置できるようになりました。
  • URL Dispatchは `` {marker} ``の代わりにルートパターンの置換マーカーを示すために `` {marker} ``という形式を使用するようになりました。古いコロンスタイルのマーカー構文は、下位互換性のために受け入れられます。新しいフォーマットでは、デフォルトの `` [^ /] + ``の代わりにそのマーカ位置の正規表現を使うことができます。例えば、 `` {marker:d +} ``はマーカを数字。
  • 人々に相対URLを生成させる `` pyramid.url.route_path`` APIを追加してください。 `` route_path``を呼び出すことは、 `` pyramid.url.route_url``を引数 `` _app_url``を空文字列と同じように呼ぶことと同じです。
  • `` pyramid.request.Request.route_path`` APIを追加してください。これは `` pyramid.url.route_url``を呼び出す要求の便利なメソッドです。
  • テストスイートをJythonに渡すようにします(PasteScriptトランクが必要です(おそらく1.7.4)。
  • テストスイートをPyPyに渡します(カメレオンは動作しません)。
  • `` config.begin() ``と `` config.end() ``を使って周囲のアプリケーション構成を行う必要はなくなりました。すべてのペーステンプレートが変更され、これらの機能は呼び出されなくなりました。
  • もし失敗したインポートが、ドット付きの名前を解決するときにドット付きの名前を使って要求されたインポートとは無関係ならば(例えば、ドット付きの名前を表示する)、Configuratorが `` ImportError``を `` ConfigurationError``に変換しないように修正しました。

ドキュメンテーション

  • SQLAlchemy + URLDispatchとZODB + Traversalチュートリアルは、 `` config.begin() ``や `` config.end() ``を呼び出さないように更新されました。

バグの修正

  • `` get_renderer``、 `` get_template``、 `` render_template``、 `` render_template_to_response``の `` pyramid.chameleon_text``と `` pyramid.chameleon_zpt``をインポートするには廃止予定警告を追加してください。
  • `` pyramid.zcml.zcml_configure``と `` pyramid.zcml.file_configure``のインポートのための廃止予定警告を追加してください。
  • The pyramid_alchemy paster template had a typo, preventing an import from working.
  • Fix apparent failures when calling pyramid.traversal.find_model(root, path) or pyramid.traversal.traverse(path) when path is (erroneously) a Unicode object. The user is meant to pass these APIs a string object, never a Unicode object. In practice, however, users indeed pass Unicode. Because the string that is passed must be ASCII encodeable, now, if they pass a Unicode object, its data is eagerly converted to an ASCII string rather than being passed along to downstream code as a convenience to the user and to prevent puzzling second-order failures from cropping up (all failures will occur within pyramid.traversal.traverse rather than later down the line as the result of calling e.g. traversal_path).

後方の非互換性

  • The pyramid.testing.zcml_configure API has been removed. It had been advertised as removed since repoze.bfg 1.2a1, but hadn't actually been.

廃止

  • The pyramid.settings.get_settings API is now deprecated. Use pyramid.threadlocals.get_current_registry().settings instead or use the settings attribute of the registry available from the request (request.registry.settings).

ドキュメンテーション

  • Removed zodbsessions tutorial chapter. It's still useful, but we now have a SessionFactory abstraction which competes with it, and maintaining documentation on both ways to do it is a distraction.

内部

  • Replace Twill with WebTest in internal integration tests (avoid deprecation warnings generated by Twill).

1.0a3 (2010-11-16)

特徴

  • Added Mako TemplateLookup settings for mako.error_handler, mako.default_filters, and mako.imports.
  • Normalized all paster templates: each now uses the name main to represent the function that returns a WSGI application, each now uses WebError, each now has roughly the same shape of development.ini style.
  • Added class vars matchdict and matched_route to pyramid.request.Request. Each is set to None.
  • New API method: pyramid.settings.asbool.
  • New API methods for pyramid.request.Request: model_url, route_url, and static_url. These are simple passthroughs for their respective functions in pyramid.url.
  • The settings object which used to be available only when request.settings.get_settings was called is now available as registry.settings (e.g. request.registry.settings in view code).

バグの修正

  • The pylons_* paster templates erroneously used the {squiggly} routing syntax as the pattern supplied to add_route. This style of routing is not supported. They were replaced with :colon style route patterns.
  • The pylons_* paster template used the same string (your_app_secret_string) for the session.secret setting in the generated development.ini. This was a security risk if left unchanged in a project that used one of the templates to produce production applications. It now uses a randomly generated string.

ドキュメンテーション

  • ZODB+traversal wiki (wiki) tutorial updated due to changes to pyramid_zodb paster template.
  • SQLAlchemy+urldispach wiki (wiki2) tutorial updated due to changes to pyramid_routesalchemy paster template.
  • Documented the matchdict and matched_route attributes of the request object in the Request API documentation.

廃止

  • Obtaining the settings object via registry.{get|query}Utility(ISettings) is now deprecated. Instead, obtain the settings object via the registry.settings attribute. A backwards compatibility shim was added to the registry object to register the settings object as an ISettings utility when setattr(registry, 'settings', foo) is called, but it will be removed in a later release.
  • Obtaining the settings object via pyramid.settings.get_settings is now deprecated. Obtain it as the settings attribute of the registry now (obtain the registry via pyramid.threadlocal.get_registry or as request.registry).

行動の違い

  • Internal: ZCML directives no longer call get_current_registry() if there's a registry attribute on the ZCML context (kill off use of threadlocals).
  • Internal: Chameleon template renderers now accept two arguments: path and lookup. Lookup will be an instance of a lookup class which supplies (late-bound) arguments for debug, reload, and translate. Any third-party renderers which use (the non-API) function pyramid.renderers.template_renderer_factory will need to adjust their implementations to obey the new callback argument list. This change was to kill off inappropriate use of threadlocals.

1.0a2 (2010-11-09)

ドキュメンテーション

  • All references to events by interface (e.g. pyramid.interfaces.INewRequest) have been changed to reference their concrete classes (e.g. pyramid.events.NewRequest) in documentation about making subscriptions.
  • All references to Pyramid-the-application were changed from mod-pyramid to app-Pyramid. A custom role setting was added to docs/conf.py to allow for this. (internal)

1.0a1 (2010-11-05)

Features (delta from BFG 1.3)

  • Mako templating renderer supports resource specification format for template lookups and within Mako templates. Absolute filenames must be used in Pyramid to avoid this lookup process.

  • Add pyramid.httpexceptions module, which is a facade for the webob.exc module.

  • Direct built-in support for the Mako templating language.

  • A new configurator method exists: add_handler. This method adds a Pylons-style "view handler" (such a thing used to be called a "controller" in Pylons 1.0).

  • New argument to configurator: session_factory.

  • New method on configurator: set_session_factory

  • Using request.session now returns a (dictionary-like) session object if a session factory has been configured.

  • The request now has a new attribute: tmpl_context for benefit of Pylons users.

  • The decorator previously known as pyramid.view.bfg_view is now known most formally as pyramid.view.view_config in docs and paster templates. An import of pyramid.view.bfg_view, however, will continue to work "forever".

  • New API methods in pyramid.session: signed_serialize and signed_deserialize.

  • New interface: pyramid.interfaces.IRendererInfo. An object of this type is passed to renderer factory constructors (see "Backwards Incompatibilities").

  • New event type: pyramid.interfaces.IBeforeRender. An object of this type is sent as an event before a renderer is invoked (but after the application-level renderer globals factory added via pyramid.configurator.configuration.set_renderer_globals_factory, if any, has injected its own keys). Applications may now subscribe to the IBeforeRender event type in order to introspect the and modify the set of renderer globals before they are passed to a renderer. The event object iself has a dictionary-like interface that can be used for this purpose. For example:

    from repoze.events import subscriber
    from pyramid.interfaces import IRendererGlobalsEvent
    
    @subscriber(IRendererGlobalsEvent)
    def add_global(event):
        event['mykey'] = 'foo'
    

    If a subscriber attempts to add a key that already exist in the renderer globals dictionary, a KeyError is raised. This limitation is due to the fact that subscribers cannot be ordered relative to each other. The set of keys added to the renderer globals dictionary by all subscribers and app-level globals factories must be unique.

  • New class: pyramid.response.Response. This is a pure facade for webob.Response (old code need not change to use this facade, it's existence is mostly for vanity and documentation-generation purposes).

  • All preexisting paster templates (except zodb) now use "imperative" configuration (starter, routesalchemy, alchemy).

  • A new paster template named pyramid_starter_zcml exists, which uses declarative configuration.

Documentation (delta from BFG 1.3)

  • Added a pyramid.httpexceptions API documentation chapter.
  • Added a pyramid.session API documentation chapter.
  • Added a Session Objects narrative documentation chapter.
  • Added an API chapter for the pyramid.personality module.
  • Added an API chapter for the pyramid.response module.
  • All documentation which previously referred to webob.Response now uses pyramid.response.Response instead.
  • The documentation has been overhauled to use imperative configuration, moving declarative configuration (ZCML) explanations to a separate narrative chapter declarative.rst.
  • The ZODB Wiki tutorial was updated to take into account changes to the pyramid_zodb paster template.
  • The SQL Wiki tutorial was updated to take into account changes to the pyramid_routesalchemy paster template.

Backwards Incompatibilities (with BFG 1.3)

  • There is no longer an IDebugLogger registered as a named utility with the name repoze.bfg.debug.

  • The logger which used to have the name of repoze.bfg.debug now has the name pyramid.debug.

  • The deprecated API pyramid.testing.registerViewPermission has been removed.

  • The deprecated API named pyramid.testing.registerRoutesMapper has been removed.

  • The deprecated API named pyramid.request.get_request was removed.

  • The deprecated API named pyramid.security.Unauthorized was removed.

  • The deprecated API named pyramid.view.view_execution_permitted was removed.

  • The deprecated API named pyramid.view.NotFound was removed.

  • The bfgshell paster command is now named pshell.

  • The Venusian "category" for all built-in Venusian decorators (e.g. subscriber and view_config/bfg_view) is now pyramid instead of bfg.

  • pyramid.renderers.rendered_response function removed; use render_pyramid.renderers.render_to_response instead.

  • Renderer factories now accept a renderer info object rather than an absolute resource specification or an absolute path. The object has the following attributes: name (the renderer= value), package (the 'current package' when the renderer configuration statement was found), type: the renderer type, registry: the current registry, and settings: the deployment settings dictionary.

    Third-party repoze.bfg renderer implementations that must be ported to Pyramid will need to account for this.

    This change was made primarily to support more flexible Mako template rendering.

  • The presence of the key repoze.bfg.message in the WSGI environment when an exception occurs is now deprecated. Instead, code which relies on this environ value should use the exception attribute of the request (e.g. request.exception[0]) to retrieve the message.

  • The values bfg_localizer and bfg_locale_name kept on the request during internationalization for caching purposes were never APIs. These however have changed to localizer and locale_name, respectively.

  • The default cookie_name value of the authtktauthenticationpolicy ZCML now defaults to auth_tkt (it used to default to repoze.bfg.auth_tkt).

  • The default cookie_name value of the pyramid.authentication.AuthTktAuthenticationPolicy constructor now defaults to auth_tkt (it used to default to repoze.bfg.auth_tkt).

  • The request_type argument to the view ZCML directive, the pyramid.configuration.Configurator.add_view method, or the pyramid.view.view_config decorator (nee bfg_view) is no longer permitted to be one of the strings GET, HEAD, PUT, POST or DELETE, and now must always be an interface. Accepting the method-strings as request_type was a backwards compatibility strategy servicing repoze.bfg 1.0 applications. Use the request_method parameter instead to specify that a view a string request-method predicate.

repoze.bfg Change History (previous name for Pyramid)

1.3b1 (2010-10-25)

特徴

  • The paster template named bfg_routesalchemy has been updated to use SQLAlchemy declarative syntax. Thanks to Ergo^.

バグの修正

  • When a renderer factory could not be found, a misleading error message was raised if the renderer name was not a string.

ドキュメンテーション

  • The ""bfgwiki2" (SQLAlchemy + url dispatch) tutorial has been updated slightly. In particular, the source packages no longer attempt to use a private index, and the recommended Python version is now 2.6. It was also updated to take into account the changes to the bfg_routesalchemy template used to set up an environment.
  • The "bfgwiki" (ZODB + traversal) tutorial has been updated slightly. In particular, the source packages no longer attempt to use a private index, and the recommended Python version is now 2.6.

1.3a15 (2010-09-30)

特徴

  • The repoze.bfg.traversal.traversal_path API now eagerly attempts to encode a Unicode path into ASCII before attempting to split it and decode its segments. This is for convenience, effectively to allow a (stored-as-Unicode-in-a-database, or retrieved-as-Unicode-from-a-request-parameter) Unicode path to be passed to find_model, which eventually internally uses the traversal_path function under the hood. In version 1.2 and prior, if the path was Unicode, that Unicode was split on slashes and each resulting segment value was Unicode. An inappropriate call to the decode() method of a resulting Unicode path segment could cause a UnicodeDecodeError to occur even if the Unicode representation of the path contained no 'high order' characters (it effectively did a "double decode"). By converting the Unicode path argument to ASCII before we attempt to decode and split, genuine errors will occur in a more obvious place while also allowing us to handle (for convenience) the case that it's a Unicode representation formed entirely from ASCII-compatible characters.

1.3a14 (2010-09-14)

バグの修正

  • If an exception view was registered through the legacy set_notfound_view or set_forbidden_view APIs, the context sent to the view was incorrect (could be None inappropriately).

特徴

  • Compatibility with WebOb 1.0.

Requirements

  • Now requires WebOb >= 1.0.

後方の非互換性

  • Due to changes introduced WebOb 1.0, the repoze.bfg.request.make_request_ascii event subscriber no longer works, so it has been removed. This subscriber was meant to be used in a deployment so that code written before BFG 0.7.0 could run unchanged. At this point, such code will need to be rewritten to expect Unicode from request.GET, request.POST and request.params or it will need to be changed to use request.str_POST, request.str_GET and/or request.str_params instead of the non-str versions of same, as the non-str versions of the same APIs always now perform decoding to Unicode.

Errata

  • A prior changelog entry asserted that the INewResponse event was not sent to listeners if the response was not "valid" (if a view or renderer returned a response object that did not have a status/headers/app_iter). This is not true in this release, nor was it true in 1.3a13.

1.3a13 (2010-09-14)

バグの修正

  • The traverse route predicate could not successfully generate a traversal path.

特徴

  • In support of making it easier to configure applications which are "secure by default", a default permission feature was added. If supplied, the default permission is used as the permission string to all view registrations which don't otherwise name a permission. These APIs are in support of that:
    • A new constructor argument was added to the Configurator: default_permission.
    • A new method was added to the Configurator: set_default_permission.
    • A new ZCML directive was added: default_permission.
  • Add a new request API: request.add_finished_callback. Finished callbacks are called by the router unconditionally near the very end of request processing. See the "Using Finished Callbacks" section of the "Hooks" narrative chapter of the documentation for more information.
  • A request.matched_route attribute is now added to the request when a route has matched. Its value is the "route" object that matched (see the IRoute interface within repoze.bfg.interfaces API documentation for the API of a route object).
  • The exception attribute of the request is now set slightly earlier and in a slightly different set of scenarios, for benefit of "finished callbacks" and "response callbacks". In previous versions, the exception attribute of the request was not set at all if an exception view was not found. In this version, the request.exception attribute is set immediately when an exception is caught by the router, even if an exception view could not be found.
  • The add_route method of a Configurator now accepts a pregenerator argument. The pregenerator for the resulting route is called by route_url in order to adjust the set of arguments passed to it by the user for special purposes, such as Pylons 'subdomain' support. It will influence the URL returned by route_url. See the repoze.bfg.interfaces.IRoutePregenerator interface for more information.

後方の非互換性

  • The router no longer sets the value wsgiorg.routing_args into the environ when a route matches. The value used to be something like ((), matchdict). This functionality was only ever obliquely referred to in change logs; it was never documented as an API.
  • The exception attribute of the request now defaults to None. In prior versions, the request.exception attribute did not exist if an exception was not raised by user code during request processing; it only began existence once an exception view was found.

廃止

  • The repoze.bfg.interfaces.IWSGIApplicationCreatedEvent event interface was renamed to repoze.bfg.interfaces.IApplicationCreated. Likewise, the repoze.bfg.events.WSGIApplicationCreatedEvent class was renamed to repoze.bfg.events.ApplicationCreated. The older aliases will continue to work indefinitely.
  • The repoze.bfg.interfaces.IAfterTraversal event interface was renamed to repoze.bfg.interfaces.IContextFound. Likewise, the repoze.bfg.events.AfterTraversal class was renamed to repoze.bfg.events.ContextFound. The older aliases will continue to work indefinitely.
  • References to the WSGI environment values bfg.routes.matchdict and bfg.routes.route were removed from documentation. These will stick around internally for several more releases, but it is request.matchdict and request.matched_route are now the "official" way to obtain the matchdict and the route object which resulted in the match.

ドキュメンテーション

  • Added documentation for the default_permission ZCML directive.
  • Added documentation for the default_permission constructor value and the set_default_permission method in the Configurator API documentation.
  • Added a new section to the "security" chapter named "Setting a Default Permission".
  • Document renderer_globals_factory and request_factory arguments to Configurator constructor.
  • Added two sections to the "Hooks" chapter of the documentation: "Using Response Callbacks" and "Using Finished Callbacks".
  • Added documentation of the request.exception attribute to the repoze.bfg.request.Request API documentation.
  • Added glossary entries for "response callback" and "finished callback".
  • The "Request Processing" narrative chapter has been updated to note finished and response callback steps.
  • New interface in interfaces API documentation: IRoutePregenerator.
  • Added a "The Matched Route" section to the URL Dispatch narrative docs chapter, detailing the matched_route attribute.

1.3a12 (2010-09-08)

バグの修正

  • Fix a bug in repoze.bfg.url.static_url URL generation: if two resource specifications were used to create two separate static views, but they shared a common prefix, it was possible that static_url would generate an incorrect URL.
  • Fix another bug in repoze.bfg.static_url URL generation: too many slashes in generated URL.
  • Prevent a race condition which could result in a RuntimeError when rendering a Chameleon template that has not already been rendered once. This would usually occur directly after a restart, when more than one person or thread is trying to execute the same view at the same time: https://bugs.launchpad.net/karl3/+bug/621364

特徴

  • The argument to repoze.bfg.configuration.Configurator.add_route which was previously called path is now called pattern for better explicability. For backwards compatibility purposes, passing a keyword argument named path to add_route will still work indefinitely.
  • The path attribute to the ZCML route directive is now named pattern for better explicability. The older path attribute will continue to work indefinitely.

ドキュメンテーション

  • All narrative, API, and tutorial docs which referred to a route pattern as a path have now been updated to refer to them as a pattern.
  • The repoze.bfg.interfaces API documentation page is now rendered via repoze.sphinx.autointerface.
  • The URL Dispatch narrative chapter now refers to the interfaces chapter to explain the API of an IRoute object.

ペースターテンプレート

  • The routesalchemy template has been updated to use pattern in its route declarations rather than path.

依存関係

  • tests_require now includes repoze.sphinx.autointerface as a dependency.

内部

  • Add an API to the Configurator named get_routes_mapper. This returns an object implementing the IRoutesMapper interface.
  • The repoze.bfg.urldispatch.RoutesMapper object now has a get_route method which returns a single Route object or None.
  • A new interface repoze.bfg.interfaces.IRoute was added. The repoze.bfg.urldispatch.Route object implements this interface.
  • The canonical attribute for accessing the routing pattern from a route object is now pattern rather than path.
  • Use hash() rather than id() when computing the "phash" of a custom route/view predicate in order to allow the custom predicate some control over which predicates are "equal".
  • Use response.headerlist.append instead of response.headers.add in repoze.bfg.request.add_global_response_headers in case the response is not a WebOb response.
  • The repoze.bfg.urldispatch.Route constructor (not an API) now accepts a different ordering of arguments. Previously it was (pattern, name, factory=None, predicates=()). It is now (name, pattern, factory=None, predicates=()). This is in support of consistency with configurator.add_route.
  • The repoze.bfg.urldispatch.RoutesMapper.connect method (not an API) now accepts a different ordering of arguments. Previously it was (pattern, name, factory=None, predicates=()). It is now (name, pattern, factory=None, predicates=()). This is in support of consistency with configurator.add_route.

1.3a11 (2010-09-05)

バグの修正

  • Process the response callbacks and the NewResponse event earlier, to enable mutations to the response to take effect.

1.3a10 (2010-09-05)

特徴

  • A new repoze.bfg.request.Request.add_response_callback API has been added. This method is documented in the new repoze.bfg.request API chapter. It can be used to influence response values before a concrete response object has been created.

  • The repoze.bfg.interfaces.INewResponse interface now includes a request attribute; as a result, a handler for INewResponse now has access to the request which caused the response.

  • Each of the follow methods of the Configurator now allow the below-named arguments to be passed as "dotted name strings" (e.g. "foo.bar.baz") rather than as actual implementation objects that must be imported:

    setup_registry

    root_factory, authentication_policy, authorization_policy, debug_logger, locale_negotiator, request_factory, renderer_globals_factory

    add_subscriber

    subscriber, iface

    derive_view

    view

    add_view

    view, for_, context, request_type, containment

    add_route()

    view, view_for, factory, for_, view_context

    scan

    package

    add_renderer

    factory

    set_forbidden_view

    view

    set_notfound_view

    view

    set_request_factory

    factory

    set_renderer_globals_factory()

    factory

    set_locale_negotiator

    negotiator

    testing_add_subscriber

    event_iface

バグの修正

  • The route pattern registered internally for a local "static view" (either via the static ZCML directive or via the add_static_view method of the configurator) was incorrect. It was regsistered for e.g. static*traverse, while it should have been registered for static/*traverse. Symptom: two static views could not reliably be added to a system when they both shared the same path prefix (e.g. /static and /static2).

後方の非互換性

  • The INewResponse event is now not sent to listeners if the response returned by view code (or a renderer) is not a "real" response (e.g. if it does not have .status, .headerlist and .app_iter attribtues).

ドキュメンテーション

  • Add an API chapter for the repoze.bfg.request module, which includes documentation for the repoze.bfg.request.Request class (the "request object").
  • Modify the "Request and Response" narrative chapter to reference the new repoze.bfg.request API chapter. Some content was moved from this chapter into the API documentation itself.
  • Various changes to denote that Python dotted names are now allowed as input to Configurator methods.

内部

  • The (internal) feature which made it possible to attach a global_response_headers attribute to the request (which was assumed to contain a sequence of header key/value pairs which would later be added to the response by the router), has been removed. The functionality of repoze.bfg.request.Request.add_response_callback takes its place.
  • The repoze.bfg.events.NewResponse class's construct has changed: it now must be created with (request, response) rather than simply (response).

1.3a9 (2010-08-22)

特徴

  • The Configurator now accepts a dotted name string to a package as a package constructor argument. The package argument was previously required to be a package object (not a dotted name string).
  • The repoze.bfg.configuration.Configurator.with_package method was added. This method returns a new Configurator using the same application registry as the configurator object it is called upon. The new configurator is created afresh with its package constructor argument set to the value passed to with_package. This feature will make it easier for future BFG versions to allow dotted names as arguments in places where currently only object references are allowed (the work to allow dotted names isntead of object references everywhere has not yet been done, however).
  • The new repoze.bfg.configuration.Configurator.maybe_dotted method resolves a Python dotted name string supplied as its dotted argument to a global Python object. If the value cannot be resolved, a repoze.bfg.configuration.ConfigurationError is raised. If the value supplied as dotted is not a string, the value is returned unconditionally without any resolution attempted.
  • The new repoze.bfg.configuration.Configurator.absolute_resource_spec method resolves a potentially relative "resource specification" string into an absolute version. If the value supplied as relative_spec is not a string, the value is returned unconditionally without any resolution attempted.

後方の非互換性

  • The functions in repoze.bfg.renderers named render and render_to_response introduced in 1.3a6 previously took a set of **values arguments for the values to be passed to the renderer. This was wrong, as renderers don't need to accept only dictionaries (they can accept any type of object). Now, the value sent to the renderer must be supplied as a positional argument named value. The request argument is still a keyword argument, however.
  • The functions in repoze.bfg.renderers named render and render_to_response now accept an additonal keyword argument named package.
  • The get_renderer API in repoze.bfg.renderers now accepts a package argument.

ドキュメンテーション

  • The ZCML include directive docs were incorrect: they specified filename rather than (the correct) file as an allowable attribute.

内部

  • The repoze.bfg.resource.resolve_resource_spec function can now accept a package object as its pname argument instead of just a package name.
  • The _renderer_factory_from_name and _renderer_from_name methods of the Configurator were removed. These were never APIs.
  • The _render, _render_to_response and _make_response functions with repoze.bfg.render (added in 1.3a6) have been removed.
  • A new helper class repoze.bfg.renderers.RendererHelper was added.
  • The _map_view function of repoze.bfg.configuration now takes only a renderer_name argument instead of both a renderer and renderer``_name argument.  It also takes a ``package argument now.
  • Use imp.get_suffixes indirection in repoze.bfg.path.package_name instead of hardcoded .py .pyc and .pyo to use for comparison when attemtping to decide if a directory is a package.
  • Make tests runnable again under Jython (although they do not all pass currently).
  • The reify decorator now maintains the docstring of the function it wraps.

1.3a8 (2010-08-08)

特徴

  • New public interface: repoze.bfg.exceptions.IExceptionResponse. This interface is provided by all internal exception classes (such as repoze.bfg.exceptions.NotFound and repoze.bfg.exceptions.Forbidden), instances of which are both exception objects and can behave as WSGI response objects. This interface is made public so that exception classes which are also valid WSGI response factories can be configured to implement them or exception instances which are also or response instances can be configured to provide them.

  • New API class: repoze.bfg.view.AppendSlashNotFoundViewFactory.

    There can only be one Not Found view in any repoze.bfg application. Even if you use repoze.bfg.view.append_slash_notfound_view as the Not Found view, repoze.bfg still must generate a 404 Not Found response when it cannot redirect to a slash-appended URL; this not found response will be visible to site users.

    If you don't care what this 404 response looks like, and you only need redirections to slash-appended route URLs, you may use the repoze.bfg.view.append_slash_notfound_view object as the Not Found view. However, if you wish to use a custom notfound view callable when a URL cannot be redirected to a slash-appended URL, you may wish to use an instance of the repoze.bfg.view.AppendSlashNotFoundViewFactory class as the Not Found view, supplying the notfound view callable as the first argument to its constructor. For instance:

    from repoze.bfg.exceptions import NotFound
    from repoze.bfg.view import AppendSlashNotFoundViewFactory
    
    def notfound_view(context, request):
        return HTTPNotFound('It aint there, stop trying!')
    
    custom_append_slash = AppendSlashNotFoundViewFactory(notfound_view)
    config.add_view(custom_append_slash, context=NotFound)
    

    The notfound_view supplied must adhere to the two-argument view callable calling convention of (context, request) (context will be the exception object).

ドキュメンテーション

  • Expanded the "Cleaning Up After a Request" section of the URL Dispatch narrative chapter.
  • Expanded the "Redirecting to Slash-Appended Routes" section of the URL Dispatch narrative chapter.

内部

  • Previously, two default view functions were registered at Configurator setup (one for repoze.bfg.exceptions.NotFound named default_notfound_view and one for repoze.bfg.exceptions.Forbidden named default_forbidden_view) to render internal exception responses. Those default view functions have been removed, replaced with a generic default view function which is registered at Configurator setup for the repoze.bfg.interfaces.IExceptionResponse interface that simply returns the exception instance; the NotFound and Forbidden classes are now still exception factories but they are also response factories which generate instances that implement the new repoze.bfg.interfaces.IExceptionResponse interface.

1.3a7 (2010-08-01)

特徴

  • The repoze.bfg.configuration.Configurator.add_route API now returns the route object that was added.
  • A repoze.bfg.events.subscriber decorator was added. This decorator decorates module-scope functions, which are then treated as event listeners after a scan() is performed. See the Events narrative documentation chapter and the repoze.bfg.events module documentation for more information.

バグの修正

  • When adding a view for a route which did not yet exist ("did not yet exist" meaning, temporally, a view was added with a route name for a route which had not yet been added via add_route), the value of the custom_predicate argument to add_view was lost. Symptom: wrong view matches when using URL dispatch and custom view predicates together.
  • Pattern matches for a :segment marker in a URL dispatch route pattern now always match at least one character. See "Backwards Incompatibilities" below in this changelog.

後方の非互換性

  • A bug existed in the regular expression to do URL matching. As an example, the URL matching machinery would cause the pattern /{foo} to match the root URL / resulting in a match dictionary of {'foo':u''} or the pattern /{fud}/edit might match the URL ``//edit resulting in a match dictionary of {'fud':u''}. It was always the intent that :segment markers in the pattern would need to match at least one character, and never match the empty string. This, however, means that in certain circumstances, a routing match which your application inadvertently depended upon may no longer happen.

ドキュメンテーション

  • Added description of the repoze.bfg.events.subscriber decorator to the Events narrative chapter.
  • Added repoze.bfg.events.subscriber API documentation to repoze.bfg.events API docs.
  • Added a section named "Zope 3 Enforces 'TTW' Authorization Checks By Default; BFG Does Not" to the "Design Defense" chapter.

1.3a6 (2010-07-25)

特徴

  • New argument to repoze.bfg.configuration.Configurator.add_route and the route ZCML directive: traverse. If you would like to cause the context to be something other than the root object when this route matches, you can spell a traversal pattern as the traverse argument. This traversal pattern will be used as the traversal path: traversal will begin at the root object implied by this route (either the global root, or the object returned by the factory associated with this route).

    The syntax of the traverse argument is the same as it is for path. For example, if the path provided is articles/:article/edit, and the traverse argument provided is /:article, when a request comes in that causes the route to match in such a way that the article match value is '1' (when the request URI is /articles/1/edit), the traversal path will be generated as /1. This means that the root object's __getitem__ will be called with the name 1 during the traversal phase. If the 1 object exists, it will become the context of the request. The Traversal narrative has more information about traversal.

    If the traversal path contains segment marker names which are not present in the path argument, a runtime error will occur. The traverse pattern should not contain segment markers that do not exist in the path.

    A similar combining of routing and traversal is available when a route is matched which contains a *traverse remainder marker in its path. The traverse argument allows you to associate route patterns with an arbitrary traversal path without using a *traverse remainder marker; instead you can use other match information.

    Note that the traverse argument is ignored when attached to a route that has a *traverse remainder marker in its path.

  • A new method of the Configurator exists: set_request_factory. If used, this method will set the factory used by the repoze.bfg router to create all request objects.

  • The Configurator constructor takes an additional argument: request_factory. If used, this argument will set the factory used by the repoze.bfg router to create all request objects.

  • The Configurator constructor takes an additional argument: request_factory. If used, this argument will set the factory used by the repoze.bfg router to create all request objects.

  • A new method of the Configurator exists: set_renderer_globals_factory. If used, this method will set the factory used by the repoze.bfg router to create renderer globals.

  • A new method of the Configurator exists: get_settings. If used, this method will return the current settings object (performs the same job as the repoze.bfg.settings.get_settings API).

  • The Configurator constructor takes an additional argument: renderer_globals_factory. If used, this argument will set the factory used by the repoze.bfg router to create renderer globals.

  • Add repoze.bfg.renderers.render, repoze.bfg.renderers.render_to_response and repoze.bfg.renderers.get_renderer functions. These are imperative APIs which will use the same rendering machinery used by view configurations with a renderer= attribute/argument to produce a rendering or renderer. Because these APIs provide a central API for all rendering, they now form the preferred way to perform imperative template rendering. Using functions named render_* from modules such as repoze.bfg.chameleon_zpt and repoze.bfg.chameleon_text is now discouraged (although not deprecated). The code the backing older templating-system-specific APIs now calls into the newer repoze.bfg.renderer code.

  • The repoze.bfg.configuration.Configurator.testing_add_template has been renamed to testing_add_renderer. A backwards compatibility alias is present using the old name.

ドキュメンテーション

  • The Hybrid narrative chapter now contains a description of the traverse route argument.
  • The Hooks narrative chapter now contains sections about changing the request factory and adding a renderer globals factory.
  • The API documentation includes a new module: repoze.bfg.renderers.
  • The Templates chapter was updated; all narrative that used templating-specific APIs within examples to perform rendering (such as the repoze.bfg.chameleon_zpt.render_template_to_response method) was changed to use repoze.bfg.renderers.render_* functions.

バグの修正

  • The header predicate (when used as either a view predicate or a route predicate) had a problem when specified with a name/regex pair. When the header did not exist in the headers dictionary, the regex match could be fed None, causing it to throw a TypeError: expected string or buffer exception. Now, the predicate returns False as intended.

廃止

  • The repoze.bfg.renderers.rendered_response function was never an official API, but may have been imported by extensions in the wild. It is officially deprecated in this release. Use repoze.bfg.renderers.render_to_response instead.

  • The following APIs are documentation deprecated (meaning they are officially deprecated in documentation but do not raise a deprecation error upon their usage, and may continue to work for an indefinite period of time):

    In the repoze.bfg.chameleon_zpt module: get_renderer, get_template, render_template, render_template_to_response. The suggested alternatives are documented within the docstrings of those methods (which are still present in the documentation).

    In the repoze.bfg.chameleon_text module: get_renderer, get_template, render_template, render_template_to_response. The suggested alternatives are documented within the docstrings of those methods (which are still present in the documentation).

    In general, to perform template-related functions, one should now use the various methods in the repoze.bfg.renderers module.

後方の非互換性

  • A new internal exception class (not an API) named repoze.bfg.exceptions.PredicateMismatch now exists. This exception is currently raised when no constituent view of a multiview can be called (due to no predicate match). Previously, in this situation, a repoze.bfg.exceptions.NotFound was raised. We provide backwards compatibility for code that expected a NotFound to be raised when no predicates match by causing repoze.bfg.exceptions.PredicateMismatch to inherit from NotFound. This will cause any exception view registered for NotFound to be called when a predicate mismatch occurs, as was the previous behavior.

    There is however, one perverse case that will expose a backwards incompatibility. If 1) you had a view that was registered as a member of a multiview 2) this view explicitly raised a NotFound exception in order to proceed to the next predicate check in the multiview, that code will now behave differently: rather than skipping to the next view match, a NotFound will be raised to the top-level exception handling machinery instead. For code to be depending upon the behavior of a view raising NotFound to proceed to the next predicate match, would be tragic, but not impossible, given that NotFound is a public interface. repoze.bfg.exceptions.PredicateMismatch is not a public API and cannot be depended upon by application code, so you should not change your view code to raise PredicateMismatch. Instead, move the logic which raised the NotFound exception in the view out into a custom view predicate.

  • If, when you run your application's unit test suite under BFG 1.3, a KeyError naming a template or a ValueError indicating that a 'renderer factory' is not registered may is raised (e.g. ValueError: No factory for renderer named '.pt' when looking up karl.views:templates/snippets.pt), you may need to perform some extra setup in your test code.

    The best solution is to use the repoze.bfg.configuration.Configurator.testing_add_renderer (or, alternately the deprecated repoze.bfg.testing.registerTemplateRenderer or registerDummyRenderer) API within the code comprising each individual unit test suite to register a "dummy" renderer for each of the templates and renderers used by code under test. For example:

    config = Configurator()
    config.testing_add_renderer('karl.views:templates/snippets.pt')
    

    This will register a basic dummy renderer for this particular missing template. The testing_add_renderer API actually returns the renderer, but if you don't care about how the render is used, you don't care about having a reference to it either.

    A more rough way to solve the issue exists. It causes the "real" template implementations to be used while the system is under test, which is suboptimal, because tests will run slower, and unit tests won't actually be unit tests, but it is easier. Always ensure you call the setup_registry() method of the Configurator . Eg:

    reg = MyRegistry()
    config = Configurator(registry=reg)
    config.setup_registry()
    

    Calling setup_registry only has an effect if you're passing in a registry argument to the Configurator constructor. setup_registry is called by the course of normal operations anyway if you do not pass in a registry.

    If your test suite isn't using a Configurator yet, and is still using the older repoze.bfg.testing APIs name setUp or cleanUp, these will register the renderers on your behalf.

    A variant on the symptom for this theme exists: you may already be dutifully registering a dummy template or renderer for a template used by the code you're testing using testing_register_renderer or registerTemplateRenderer, but (perhaps unbeknownst to you) the code under test expects to be able to use a "real" template renderer implementation to retrieve or render another template that you forgot was being rendered as a side effect of calling the code you're testing. This happened to work because it found the real template while the system was under test previously, and now it cannot. The solution is the same.

    It may also help reduce confusion to use a resource specification to specify the template path in the test suite and code rather than a relative path in either. A resource specification is unambiguous, while a relative path needs to be relative to "here", where "here" isn't always well-defined ("here" in a test suite may or may not be the same as "here" in the code under test).

1.3a5 (2010-07-14)

特徴

  • New internal exception: repoze.bfg.exceptions.URLDecodeError. This URL is a subclass of the built-in Python exception named UnicodeDecodeError.
  • When decoding a URL segment to Unicode fails, the exception raised is now repoze.bfg.exceptions.URLDecodeError instead of UnicodeDecodeError. This makes it possible to register an exception view invoked specifically when repoze.bfg cannot decode a URL.

バグの修正

  • Fix regression in repoze.bfg.configuration.Configurator.add_static_view. Before 1.3a4, view names that contained a slash were supported as route prefixes. 1.3a4 broke this by trying to treat them as full URLs.

ドキュメンテーション

  • The repoze.bfg.exceptions.URLDecodeError exception was added to the exceptions chapter of the API documentation.

後方の非互換性

  • in previous releases, when a URL could not be decoded from UTF-8 during traversal, a TypeError was raised. Now the error which is raised is a repoze.bfg.exceptions.URLDecodeError.

1.3a4 (2010-07-03)

特徴

  • Undocumented hook: make get_app and get_root of the repoze.bfg.paster.BFGShellCommand hookable in cases where endware may interfere with the default versions.

  • In earlier versions, a custom route predicate associated with a url dispatch route (each of the predicate functions fed to the custom_predicates argument of repoze.bfg.configuration.Configurator.add_route) has always required a 2-positional argument signature, e.g. (context, request). Before this release, the context argument was always None.

    As of this release, the first argument passed to a predicate is now a dictionary conventionally named info consisting of route, and match. match is a dictionary: it represents the arguments matched in the URL by the route. route is an object representing the route which was matched.

    This is useful when predicates need access to the route match. For example:

    def any_of(segment_name, *args):
        def predicate(info, request):
            if info['match'][segment_name] in args:
                return True
        return predicate
    
    num_one_two_or_three = any_of('num, 'one', 'two', 'three')
    
    add_route('num', '/:num', custom_predicates=(num_one_two_or_three,))
    

    The route object is an object that has two useful attributes: name and path. The name attribute is the route name. The path attribute is the route pattern. An example of using the route in a set of route predicates:

    def twenty_ten(info, request):
        if info['route'].name in ('ymd', 'ym', 'y'):
            return info['match']['year'] == '2010'
    
    add_route('y', '/:year', custom_predicates=(twenty_ten,))
    add_route('ym', '/:year/:month', custom_predicates=(twenty_ten,))
    add_route('ymd', '/:year/:month:/day', custom_predicates=(twenty_ten,))
    
  • The repoze.bfg.url.route_url API has changed. If a keyword _app_url is present in the arguments passed to route_url, this value will be used as the protocol/hostname/port/leading path prefix of the generated URL. For example, using an _app_url of http://example.com:8080/foo would cause the URL http://example.com:8080/foo/fleeb/flub to be returned from this function if the expansion of the route pattern associated with the route_name expanded to /fleeb/flub.

  • It is now possible to use a URL as the name argument fed to repoze.bfg.configuration.Configurator.add_static_view. When the name argument is a URL, the repoze.bfg.url.static_url API will generate join this URL (as a prefix) to a path including the static file name. This makes it more possible to put static media on a separate webserver for production, while keeping static media package-internal and served by the development webserver during development.

ドキュメンテーション

  • The authorization chapter of the ZODB Wiki Tutorial (docs/tutorials/bfgwiki) was changed to demonstrate authorization via a group rather than via a direct username (thanks to Alex Marandon).
  • The authorization chapter of the SQLAlchemy Wiki Tutorial (docs/tutorials/bfgwiki2) was changed to demonstrate authorization via a group rather than via a direct username.
  • Redirect requests for tutorial sources to http://docs.repoze.org/bfgwiki-1.3 and http://docs.repoze.org/bfgwiki2-1.3/ respectively.
  • A section named Custom Route Predicates was added to the URL Dispatch narrative chapter.
  • The Static Resources chapter has been updated to mention using static_url to generate URLs to external webservers.

内部

  • Removed repoze.bfg.static.StaticURLFactory in favor of a new abstraction revolving around the (still-internal) repoze.bfg.static.StaticURLInfo helper class.

1.3a3 (2010-05-01)

ペースターテンプレート

  • The bfg_alchemy and bfg_routesalchemy templates no longer register a handle_teardown event listener which calls DBSession.remove. This was found by Chris Withers to be unnecessary.

ドキュメンテーション

  • The "bfgwiki2" (URL dispatch wiki) tutorial code and documentation was changed to remove the handle_teardown event listener which calls DBSession.remove.
  • Any mention of the handle_teardown event listener as used by the paster templates was removed from the URL Dispatch narrative chapter.
  • A section entitled Detecting Available Languages was added to the i18n narrative docs chapter.

1.3a2 (2010-04-28)

特徴

  • A locale negotiator no longer needs to be registered explicitly. The default locale negotiator at repoze.bfg.i18n.default_locale_negotiator is now used unconditionally as... um, the default locale negotiator.
  • The default locale negotiator has become more complex.
    • First, the negotiator looks for the _LOCALE_ attribute of the request object (possibly set by a view or an event listener).
    • Then it looks for the request.params['_LOCALE_'] value.
    • Then it looks for the request.cookies['_LOCALE_'] value.

後方の非互換性

  • The default locale negotiator now looks for the parameter named _LOCALE_ rather than a parameter named locale in request.params.

行動の変化

  • A locale negotiator may now return None, signifying that the default locale should be used.

ドキュメンテーション

  • Documentation concerning locale negotiation in the Internationalizationa and Localization chapter was updated.
  • Expanded portion of i18n narrative chapter docs which discuss working with gettext files.

1.3a1 (2010-04-26)

特徴

  • Added "exception views". When you use an exception (anything that inherits from the Python Exception builtin) as view context argument, e.g.:

    from repoze.bfg.view import bfg_view
    from repoze.bfg.exceptions import NotFound
    from webob.exc import HTTPNotFound
    
    @bfg_view(context=NotFound)
    def notfound_view(request):
        return HTTPNotFound()
    

    For the above example, when the repoze.bfg.exceptions.NotFound exception is raised by any view or any root factory, the notfound_view view callable will be invoked and its response returned.

    Other normal view predicates can also be used in combination with an exception view registration:

    from repoze.bfg.view import bfg_view
    from repoze.bfg.exceptions import NotFound
    from webob.exc import HTTPNotFound
    
    @bfg_view(context=NotFound, route_name='home')
    def notfound_view(request):
        return HTTPNotFound()
    

    The above exception view names the route_name of home, meaning that it will only be called when the route matched has a name of home. You can therefore have more than one exception view for any given exception in the system: the "most specific" one will be called when the set of request circumstances which match the view registration. The only predicate that cannot be not be used successfully is name. The name used to look up an exception view is always the empty string.

    Existing (pre-1.3) normal views registered against objects inheriting from Exception will continue to work. Exception views used for user-defined exceptions and system exceptions used as contexts will also work.

    The feature can be used with any view registration mechanism (@bfg_view decorator, ZCML, or imperative config.add_view styles).

    This feature was kindly contributed by Andrey Popp.

  • Use "Venusian" (http://docs.repoze.org/venusian) to perform bfg_view decorator scanning rather than relying on a BFG-internal decorator scanner. (Truth be told, Venusian is really just a generalization of the BFG-internal decorator scanner).

  • Internationalization and localization features as documented in the narrative documentation chapter entitled Internationalization and Localization.

  • A new deployment setting named default_locale_name was added. If this string is present as a Paster .ini file option, it will be considered the default locale name. The default locale name is used during locale-related operations such as language translation.

  • It is now possible to turn on Chameleon template "debugging mode" for all Chameleon BFG templates by setting a BFG-related Paster .ini file setting named debug_templates. The exceptions raised by Chameleon templates when a rendering fails are sometimes less than helpful. debug_templates allows you to configure your application development environment so that exceptions generated by Chameleon during template compilation and execution will contain more helpful debugging information. This mode is on by default in all new projects.

  • Add a new method of the Configurator named derive_view which can be used to generate a BFG view callable from a user-supplied function, instance, or class. This useful for external framework and plugin authors wishing to wrap callables supplied by their users which follow the same calling conventions and response conventions as objects that can be supplied directly to BFG as a view callable. See the derive_view method in the repoze.bfg.configuration.Configurator docs.

ZCML

  • Add a translationdir ZCML directive to support localization.
  • Add a localenegotiator ZCML directive to support localization.

廃止

  • The exception views feature replaces the need for the set_notfound_view and set_forbidden_view methods of the Configurator as well as the notfound and forbidden ZCML directives. Those methods and directives will continue to work for the foreseeable future, but they are deprecated in the documentation.

依存関係

  • A new install-time dependency on the venusian distribution was added.
  • A new install-time dependency on the translationstring distribution was added.
  • Chameleon 1.2.3 or better is now required (internationalization and per-template debug settings).

内部

  • View registrations and lookups are now done with three "requires" arguments instead of two to accomodate orthogonality of exception views.
  • The repoze.bfg.interfaces.IForbiddenView and repoze.bfg.interfaces.INotFoundView interfaces were removed; they weren't APIs and they became vestigial with the addition of exception views.
  • Remove repoze.bfg.compat.pkgutil_26.py and import alias repoze.bfg.compat.walk_packages. These were only required by internal scanning machinery; Venusian replaced the internal scanning machinery, so these are no longer required.

ドキュメンテーション

  • Exception view documentation was added to the Hooks narrative chapter.
  • A new narrative chapter entitled Internationalization and Localization was added.
  • The "Environment Variables and ini File Settings" chapter was changed: documentation about the default_locale_name setting was added.
  • A new API chapter for the repoze.bfg.i18n module was added.
  • Documentation for the new translationdir and localenegotiator ZCML directives were added.
  • A section was added to the Templates chapter entitled "Nicer Exceptions in Templates" describing the result of setting debug_templates = true.

ペースターテンプレート

  • All paster templates now create a setup.cfg which includes commands related to nose testing and Babel message catalog extraction/compilation.
  • A default_locale_name = en setting was added to each existing paster template.
  • A debug_templates = true setting was added to each existing paster template.

Licensing

  • The Edgewall (BSD) license was added to the LICENSES.txt file, as some code in the repoze.bfg.i18n derives from Babel source.

1.2 (2010-02-10)

  • No changes from 1.2b6.

1.2b6 (2010-02-06)

後方の非互換性

  • Remove magical feature of repoze.bfg.url.model_url which prepended a fully-expanded urldispatch route URL before a the model's path if it was noticed that the request had matched a route. This feature was ill-conceived, and didn't work in all scenarios.

バグの修正

  • More correct conversion of provided renderer values to resource specification values (internal).

1.2b5 (2010-02-04)

バグの修正

  • 1.2b4 introduced a bug whereby views added via a route configuration that named a view callable and also a view_attr became broken. Symptom: MyViewClass is not callable or the __call__ of a class was being called instead of the method named via view_attr.
  • Fix a bug whereby a renderer argument to the @bfg_view decorator that provided a package-relative template filename might not have been resolved properly. Symptom: inappropriate Missing template resource errors.

1.2b4 (2010-02-03)

ドキュメンテーション

  • Update GAE tutorial to use Chameleon instead of Jinja2 (now that it's possible).

バグの修正

  • Ensure that secure flag for AuthTktAuthenticationPolicy constructor does what it's documented to do (merge Daniel Holth's fancy-cookies-2 branch).

特徴

  • Add path and http_only options to AuthTktAuthenticationPolicy constructor (merge Daniel Holth's fancy-cookies-2 branch).

後方の非互換性

  • Remove view_header, view_accept, view_xhr, view_path_info, view_request_method, view_request_param, and view_containment predicate arguments from the Configurator.add_route argument list. These arguments were speculative. If you need the features exposed by these arguments, add a view associated with a route using the route_name argument to the add_view method instead.
  • Remove view_header, view_accept, view_xhr, view_path_info, view_request_method, view_request_param, and view_containment predicate arguments from the route ZCML directive attribute set. These attributes were speculative. If you need the features exposed by these attributes, add a view associated with a route using the route_name attribute of the view ZCML directive instead.

依存関係

  • Remove dependency on sourcecodegen (not depended upon by Chameleon 1.1.1+).

1.2b3 (2010-01-24)

バグの修正

  • When "hybrid mode" (both traversal and urldispatch) is in use, default to finding route-related views even if a non-route-related view registration has been made with a more specific context. The default used to be to find views with a more specific context first. Use the new use_global_views argument to the route definition to get back the older behavior.

特徴

  • Add use_global_views argument to add_route method of Configurator. When this argument is true, views registered for no route will be found if no more specific view related to the route is found.
  • Add use_global_views attribute to ZCML <route> directive (see above).

内部

  • When registering a view, register the view adapter with the "requires" interfaces as (request_type, context_type) rather than (context_type, request_type). This provides for saner lookup, because the registration will always be made with a specific request interface, but registration may not be made with a specific context interface. In general, when creating multiadapters, you want to order the requires interfaces so that the elements which are more likely to be registered using specific interfaces are ordered before those which are less likely.

1.2b2 (2010-01-21)

バグの修正

  • When the Configurator is passed an instance of zope.component.registry.Components as a registry constructor argument, fix the instance up to have the attributes we expect of an instance of repoze.bfg.registry.Registry when setup_registry is called. This makes it possible to use the global Zope component registry as a BFG application registry.
  • When WebOb 0.9.7.1 was used, a deprecation warning was issued for the class attribute named charset within repoze.bfg.request.Request. BFG now requires WebOb >= 0.9.7, and code was added so that this deprecation warning has disappeared.
  • Fix a view lookup ordering bug whereby a view with a larger number of predicates registered first (literally first, not "earlier") for a triad would lose during view lookup to one registered with fewer.
  • Make sure views with exactly N custom predicates are always called before views with exactly N non-custom predicates given all else is equal in the view configuration.

ドキュメンテーション

  • Change renderings of ZCML directive documentation.
  • Add a narrative documentation chapter: "Using the Zope Component Architecture in repoze.bfg".

依存関係

  • Require WebOb >= 0.9.7

1.2b1 (2010-01-18)

バグの修正

  • In bfg_routesalchemy, bfg_alchemy paster templates and the bfgwiki2 tutorial, clean up the SQLAlchemy connection by registering a repoze.tm.after_end callback instead of relying on a __del__ method of a Cleanup class added to the WSGI environment. The __del__ strategy was fragile and caused problems in the wild. Thanks to Daniel Holth for testing.

特徴

  • Read logging configuration from PasteDeploy config file loggers section (and related) when paster bfgshell is invoked.

ドキュメンテーション

  • Major rework in preparation for book publication.

1.2a11 (2010-01-05)

バグの修正

  • Make paster bfgshell and paster create -t bfg_xxx work on Jython (fix minor incompatibility with treatment of __doc__ at the class level).
  • Updated dependency on WebOb to require a version which supports features now used in tests.

特徴

  • Jython compatibility (at least when repoze.bfg.jinja2 is used as the templating engine; Chameleon does not work under Jython).
  • Show the derived abspath of template resource specifications in the traceback when a renderer template cannot be found.
  • Show the original traceback when a Chameleon template cannot be rendered due to a platform incompatibility.

1.2a10 (2010-01-04)

特徴

  • The Configurator.add_view method now accepts an argument named context. This is an alias for the older argument named for_; it is preferred over for_, but for_ will continue to be supported "forever".
  • The view ZCML directive now accepts an attribute named context. This is an alias for the older attribute named for; it is preferred over for, but for will continue to be supported "forever".
  • The Configurator.add_route method now accepts an argument named view_context. This is an alias for the older argument named view_for; it is preferred over view_for, but view_for will continue to be supported "forever".
  • The route ZCML directive now accepts an attribute named view_context. This is an alias for the older attribute named view_for; it is preferred over view_for, but view_for will continue to be supported "forever".

Documentation and Paster Templates

  • LaTeX rendering tweaks.
  • All uses of the Configurator.add_view method that used its for_ argument now use the context argument instead.
  • All uses of the Configurator.add_route method that used its view_for argument now use the view_context argument instead.
  • All uses of the view ZCML directive that used its for attribute now use the context attribute instead.
  • All uses of the route ZCML directive that used its view_for attribute now use the view_context attribute instead.
  • Add a (minimal) tutorial dealing with use of repoze.catalog in a repoze.bfg application.

Documentation Licensing

1.2a9 (2009-12-27)

Documentation Licensing

  • The documentation (the result of make <html|latex|htmlhelp> within the docs directory) in this release is now offered under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License as described by http://creativecommons.org/licenses/by-nc-nd/3.0/us/ . This is only a licensing change for the documentation; the repoze.bfg software continues to be offered under the Repoze Public License at http://repoze.org/license.html (BSD-like).

ドキュメンテーション

  • Added manual index entries to generated index.
  • Document the previously existing (but non-API) repoze.bfg.configuration.Configurator.setup_registry method as an official API of a Configurator.
  • Fix syntax errors in various documentation code blocks.
  • Created new top-level documentation section: "ZCML Directives". This section contains detailed ZCML directive information, some of which was removed from various narrative chapters.
  • The LaTeX rendering of the documentation has been improved.
  • Added a "Fore-Matter" section with author, copyright, and licensing information.

1.2a8 (2009-12-24)

特徴

  • Add a **kw arg to the Configurator.add_settings API.
  • Add hook_zca and unhook_zca methods to the Configurator API.
  • The repoze.bfg.testing.setUp method now returns a Configurator instance which can be used to do further configuration during unit tests.

バグの修正

  • The json renderer failed to set the response content type to application/json. It now does, by setting request.response_content_type unless this attribute is already set.
  • The string renderer failed to set the response content type to text/plain. It now does, by setting request.response_content_type unless this attribute is already set.

ドキュメンテーション

  • General documentation improvements by using better Sphinx roles such as "class", "func", "meth", and so on. This means that there are many more hyperlinks pointing to API documentation for API definitions in all narrative, tutorial, and API documentation elements.
  • Added a description of imperative configuration in various places which only described ZCML configuration.
  • A syntactical refreshing of various tutorials.
  • Added the repoze.bfg.authentication, repoze.bfg.authorization, and repoze.bfg.interfaces modules to API documentation.

廃止

  • The repoze.bfg.testing.registerRoutesMapper API (added in an early 1.2 alpha) was deprecated. Its import now generates a deprecation warning.

1.2a7 (2009-12-20)

特徴

  • Add four new testing-related APIs to the repoze.bfg.configuration.Configurator class: testing_securitypolicy, testing_models, testing_add_subscriber, and testing_add_template. These were added in order to provide more direct access to the functionality of the repoze.bfg.testing APIs named registerDummySecurityPolicy, registerModels, registerEventListener, and registerTemplateRenderer when a configurator is used. The testing APIs named are nominally deprecated (although they will likely remain around "forever", as they are in heavy use in the wild).
  • Add a new API to the repoze.bfg.configuration.Configurator class: add_settings. This API can be used to add "settings" (information returned within via the repoze.bfg.settings.get_settings API) after the configurator has been initially set up. This is most useful for testing purposes.
  • Add a custom_predicates argument to the Configurator add_view method, the bfg_view decorator and the attribute list of the ZCML view directive. If custom_predicates is specified, it must be a sequence of predicate callables (a predicate callable accepts two arguments: context and request and returns True or False). The associated view callable will only be invoked if all custom predicates return True. Use one or more custom predicates when no existing predefined predicate is useful. Predefined and custom predicates can be mixed freely.
  • Add a custom_predicates argument to the Configurator add_route and the attribute list of the ZCML route directive. If custom_predicates is specified, it must be a sequence of predicate callables (a predicate callable accepts two arguments: context and request and returns True or False). The associated route will match will only be invoked if all custom predicates return True, else route matching continues. Note that the value context will always be None when passed to a custom route predicate. Use one or more custom predicates when no existing predefined predicate is useful. Predefined and custom predicates can be mixed freely.

内部

  • Remove the repoze.bfg.testing.registerTraverser function. This function was never an API.

Documenation

  • Doc-deprecated most helper functions in the repoze.bfg.testing module. These helper functions likely won't be removed any time soon, nor will they generate a warning any time soon, due to their heavy use in the wild, but equivalent behavior exists in methods of a Configurator.

1.2a6 (2009-12-18)

特徴

  • The Configurator object now has two new methods: begin and end. The begin method is meant to be called before any "configuration" begins (e.g. before add_view, et. al are called). The end method is meant to be called after all "configuration" is complete.

    Previously, before there was imperative configuration at all (1.1 and prior), configuration begin and end was invariably implied by the process of loading a ZCML file. When a ZCML load happened, the threadlocal data structure containing the request and registry was modified before the load, and torn down after the load, making sure that all framework code that needed get_current_registry for the duration of the ZCML load was satisfied.

    Some API methods called during imperative configuration, (such as Configurator.add_view when a renderer is involved) end up for historical reasons calling get_current_registry. However, in 1.2a5 and below, the Configurator supplied no functionality that allowed people to make sure that get_current_registry returned the registry implied by the configurator being used. begin now serves this purpose. Inversely, end pops the thread local stack, undoing the actions of begin.

    We make this boundary explicit to reduce the potential for confusion when the configurator is used in different circumstances (e.g. in unit tests and app code vs. just in initial app setup).

    Existing code written for 1.2a1-1.2a5 which does not call begin or end continues to work in the same manner it did before. It is however suggested that this code be changed to call begin and end to reduce the potential for confusion in the future.

  • All paster templates which generate an application skeleton now make use of the new begin and end methods of the Configurator they use in their respective copies of run.py and tests.py.

ドキュメンテーション

  • All documentation that makes use of a Configurator object to do application setup and test setup now makes use of the new begin and end methods of the configurator.

バグの修正

  • When a repoze.bfg.exceptions.NotFound or repoze.bfg.exceptions.Forbidden class (as opposed to instance) was raised as an exception within a root factory (or route root factory), the exception would not be caught properly by the repoze.bfg. Router and it would propagate to up the call stack, as opposed to rendering the not found view or the forbidden view as would have been expected.
  • When Chameleon page or text templates used as renderers were added imperatively (via Configurator.add_view or some derivative), they too-eagerly attempted to look up the reload_templates setting via get_settings, meaning they were always registered in non-auto-reload-mode (the default). Each now waits until its respective template attribute is accessed to look up the value.
  • When a route with the same name as a previously registered route was added, the old route was not removed from the mapper's routelist. Symptom: the old registered route would be used (and possibly matched) during route lookup when it should not have had a chance to ever be used.

1.2a5 (2009-12-10)

特徴

  • When the repoze.bfg.exceptions.NotFound or repoze.bfg.exceptions.Forbidden error is raised from within a custom root factory or the factory of a route, the appropriate response is now sent to the requesting user agent (the result of the notfound view or the forbidden view, respectively). When these errors are raised from within a root factory, the context passed to the notfound or forbidden view will be None. Also, the request will not be decorated with view_name, subpath, context, etc. as would normally be the case if traversal had been allowed to take place.

内部

  • The exception class representing the error raised by various methods of a Configurator is now importable as repoze.bfg.exceptions.ConfigurationError.

ドキュメンテーション

  • General documentation freshening which takes imperative configuration into account in more places and uses glossary references more liberally.
  • Remove explanation of changing the request type in a new request event subscriber, as other predicates are now usually an easier way to get this done.
  • Added "Thread Locals" narrative chapter to documentation, and added a API chapter documenting the repoze.bfg.threadlocals module.
  • Added a "Special Exceptions" section to the "Views" narrative documentation chapter explaining the effect of raising repoze.bfg.exceptions.NotFound and repoze.bfg.exceptions.Forbidden from within view code.

依存関係

  • A new dependency on the twill package was added to the setup.py tests_require argument (Twill will only be downloaded when repoze.bfg setup.py test or setup.py nosetests is invoked).

1.2a4 (2009-12-07)

特徴

  • repoze.bfg.testing.DummyModel now accepts a new constructor keyword argument: __provides__. If this constructor argument is provided, it should be an interface or a tuple of interfaces. The resulting model will then provide these interfaces (they will be attached to the constructed model via zope.interface.alsoProvides).

バグの修正

  • Operation on GAE was broken, presumably because the repoze.bfg.configuration module began to attempt to import the repoze.bfg.chameleon_zpt and repoze.bfg.chameleon_text modules, and these cannot be used on non-CPython platforms. It now tolerates startup time import failures for these modules, and only raise an import error when a template from one of these packages is actually used.

1.2a3 (2009-12-02)

バグの修正

  • The repoze.bfg.url.route_url function inappropriately passed along _query and/or _anchor arguments to the mapper.generate function, resulting in blowups.
  • When two views were registered with differering for interfaces or classes, and the for of first view registered was a superclass of the second, the repoze.bfg view machinery would incorrectly associate the two views with the same "multiview". Multiviews are meant to be collections of views that have exactly the same for/request/viewname values, without taking inheritance into account. Symptom: wrong view callable found even when you had correctly specified a for_ interface/class during view configuration for one or both view configurations.

後方の非互換性

  • The repoze.bfg.templating module has been removed; it had been deprecated in 1.1 and never actually had any APIs in it.

1.2a2 (2009-11-29)

バグの修正

  • The long description of this package (as shown on PyPI) was not valid reStructuredText, and so was not renderable.
  • Trying to use an HTTP method name string such as GET as a request_type predicate argument caused a startup time failure when it was encountered in imperative configuration or in a decorator (symptom: Type Error: Required specification must be a specification). This now works again, although request_method is now the preferred predicate argument for associating a view configuration with an HTTP request method.

ドキュメンテーション

  • Fixed "Startup" narrative documentation chapter; it was explaining "the old way" an application constructor worked.

1.2a1 (2009-11-28)

特徴

  • An imperative configuration mode.

    A repoze.bfg application can now begin its life as a single Python file. Later, the application might evolve into a set of Python files in a package. Even later, it might start making use of other configuration features, such as ZCML. But neither the use of a package nor the use of non-imperative configuration is required to create a simple repoze.bfg application any longer.

    Imperative configuration makes repoze.bfg competetive with "microframeworks" such as Bottle and Tornado. repoze.bfg has a good deal of functionality that most microframeworks lack, so this is hopefully a "best of both worlds" feature.

    The simplest possible repoze.bfg application is now:

    from webob import Response
    from wsgiref import simple_server
    from repoze.bfg.configuration import Configurator
    
    def hello_world(request):
        return Response('Hello world!')
    
    if __name__ == '__main__':
        config = Configurator()
        config.add_view(hello_world)
        app = config.make_wsgi_app()
        simple_server.make_server('', 8080, app).serve_forever()
    
  • A new class now exists: repoze.bfg.configuration.Configurator. This class forms the basis for sharing machinery between "imperatively" configured applications and traditional declaratively-configured applications.

  • The repoze.bfg.testing.setUp function now accepts three extra optional keyword arguments: registry, request and hook_zca.

    If the registry argument is not None, the argument will be treated as the registry that is set as the "current registry" (it will be returned by repoze.bfg.threadlocal.get_current_registry) for the duration of the test. If the registry argument is None (the default), a new registry is created and used for the duration of the test.

    The value of the request argument is used as the "current request" (it will be returned by repoze.bfg.threadlocal.get_current_request) for the duration of the test; it defaults to None.

    If hook_zca is True (the default), the zope.component.getSiteManager function will be hooked with a function that returns the value of registry (or the default-created registry if registry is None) instead of the registry returned by zope.component.getGlobalSiteManager, causing the Zope Component Architecture API (getSiteManager, getAdapter, getUtility, and so on) to use the testing registry instead of the global ZCA registry.

  • The repoze.bfg.testing.tearDown function now accepts an unhook_zca argument. If this argument is True (the default), zope.component.getSiteManager.reset() will be called. This will cause the result of the zope.component.getSiteManager function to be the global ZCA registry (the result of zope.component.getGlobalSiteManager) once again.

  • The run.py module in various repoze.bfg paster templates now use a repoze.bfg.configuration.Configurator class instead of the (now-legacy) repoze.bfg.router.make_app function to produce a WSGI application.

ドキュメンテーション

  • The documentation now uses the "request-only" view calling convention in most examples (as opposed to the context, request convention). This is a documentation-only change; the context, request convention is also supported and documented, and will be "forever".
  • repoze.bfg.configuration API documentation has been added.
  • A narrative documentation chapter entitled "Creating Your First repoze.bfg Application" has been added. This chapter details usage of the new repoze.bfg.configuration.Configurator class, and demonstrates a simplified "imperative-mode" configuration; doing repoze.bfg application configuration imperatively was previously much more difficult.
  • A narrative documentation chapter entitled "Configuration, Decorations and Code Scanning" explaining ZCML- vs. imperative- vs. decorator-based configuration equivalence.
  • The "ZCML Hooks" chapter has been renamed to "Hooks"; it documents how to override hooks now via imperative configuration and ZCML.
  • The explanation about how to supply an alternate "response factory" has been removed from the "Hooks" chapter. This feature may be removed in a later release (it still works now, it's just not documented).
  • Add a section entitled "Test Set Up and Tear Down" to the unittesting chapter.

バグの修正

  • The ACL authorization policy debugging output when debug_authorization console debugging output was turned on wasn't as clear as it could have been when a view execution was denied due to an authorization failure resulting from the set of principals passed never having matched any ACE in any ACL in the lineage. Now in this case, we report <default deny> as the ACE value and either the root ACL or <No ACL found on any object in model lineage> if no ACL was found.
  • When two views were registered with the same accept argument, but were otherwise registered with the same arguments, if a request entered the application which had an Accept header that accepted either of the media types defined by the set of views registered with predicates that otherwise matched, a more or less "random" one view would "win". Now, we try harder to use the view callable associated with the view configuration that has the most specific accept argument. Thanks to Alberto Valverde for an initial patch.

内部

  • The routes mapper is no longer a root factory wrapper. It is now consulted directly by the router.

  • The repoze.bfg.registry.make_registry callable has been removed.

  • The repoze.bfg.view.map_view callable has been removed.

  • The repoze.bfg.view.owrap_view callable has been removed.

  • The repoze.bfg.view.predicate_wrap callable has been removed.

  • The repoze.bfg.view.secure_view callable has been removed.

  • The repoze.bfg.view.authdebug_view callable has been removed.

  • The repoze.bfg.view.renderer_from_name callable has been removed. Use repoze.bfg.configuration.Configurator.renderer_from_name instead (still not an API, however).

  • The repoze.bfg.view.derive_view callable has been removed. Use repoze.bfg.configuration.Configurator.derive_view instead (still not an API, however).

  • The repoze.bfg.settings.get_options callable has been removed. Its job has been subsumed by the repoze.bfg.settings.Settings class constructor.

  • The repoze.bfg.view.requestonly function has been moved to repoze.bfg.configuration.requestonly.

  • The repoze.bfg.view.rendered_response function has been moved to repoze.bfg.configuration.rendered_response.

  • The repoze.bfg.view.decorate_view function has been moved to repoze.bfg.configuration.decorate_view.

  • The repoze.bfg.view.MultiView class has been moved to repoze.bfg.configuration.MultiView.

  • The repoze.bfg.zcml.Uncacheable class has been removed.

  • The repoze.bfg.resource.resource_spec function has been removed.

  • All ZCML directives which deal with attributes which are paths now use the path method of the ZCML context to resolve a relative name to an absolute one (imperative configuration requirement).

  • The repoze.bfg.scripting.get_root API now uses a 'real' WebOb request rather than a FakeRequest when it sets up the request as a threadlocal.

  • The repoze.bfg.traversal.traverse API now uses a 'real' WebOb request rather than a FakeRequest when it calls the traverser.

  • The repoze.bfg.request.FakeRequest class has been removed.

  • Most uses of the ZCA threadlocal API (the getSiteManager, getUtility, getAdapter, getMultiAdapter threadlocal API) have been removed from the core. Instead, when a threadlocal is necessary, the core uses the repoze.bfg.threadlocal.get_current_registry API to obtain the registry.

  • The internal ILogger utility named repoze.bfg.debug is now just an IDebugLogger unnamed utility. A named utility with the old name is registered for b/w compat.

  • The repoze.bfg.interfaces.ITemplateRendererFactory interface was removed; it has become unused.

  • Instead of depending on the martian package to do code scanning, we now just use our own scanning routines.

  • We now no longer have a dependency on repoze.zcml package; instead, the repoze.bfg package includes implementations of the adapter, subscriber and utility directives.

  • Relating to the following functions:

    repoze.bfg.view.render_view

    repoze.bfg.view.render_view_to_iterable

    repoze.bfg.view.render_view_to_response

    repoze.bfg.view.append_slash_notfound_view

    repoze.bfg.view.default_notfound_view

    repoze.bfg.view.default_forbidden_view

    repoze.bfg.configuration.rendered_response

    repoze.bfg.security.has_permission

    repoze.bfg.security.authenticated_userid

    repoze.bfg.security.effective_principals

    repoze.bfg.security.view_execution_permitted

    repoze.bfg.security.remember

    repoze.bfg.security.forget

    repoze.bfg.url.route_url

    repoze.bfg.url.model_url

    repoze.bfg.url.static_url

    repoze.bfg.traversal.virtual_root

    Each of these functions now expects to be called with a request object that has a registry attribute which represents the current repoze.bfg registry. They fall back to obtaining the registry from the threadlocal API.

Backwards Incompatibilites

  • Unit tests which use zope.testing.cleanup.cleanUp for the purpose of isolating tests from one another may now begin to fail due to lack of isolation between tests.

    Here's why: In repoze.bfg 1.1 and prior, the registry returned by repoze.bfg.threadlocal.get_current_registry when no other registry had been pushed on to the threadlocal stack was the zope.component.globalregistry.base global registry (aka the result of zope.component.getGlobalSiteManager()). In repoze.bfg 1.2+, however, the registry returned in this situation is the new module-scope repoze.bfg.registry.global_registry object. The zope.testing.cleanup.cleanUp function clears the zope.component.globalregistry.base global registry unconditionally. However, it does not know about the repoze.bfg.registry.global_registry object, so it does not clear it.

    If you use the zope.testing.cleanup.cleanUp function in the setUp of test cases in your unit test suite instead of using the (more correct as of 1.1) repoze.bfg.testing.setUp, you will need to replace all calls to zope.testing.cleanup.cleanUp with a call to repoze.bfg.testing.setUp.

    If replacing all calls to zope.testing.cleanup.cleanUp with a call to repoze.bfg.testing.setUp is infeasible, you can put this bit of code somewhere that is executed exactly once (not for each test in a test suite; in the `` __init__.py`` of your package or your package's tests subpackage would be a reasonable place):

    import zope.testing.cleanup
    from repoze.bfg.testing import setUp
    zope.testing.cleanup.addCleanUp(setUp)
    
  • When there is no "current registry" in the repoze.bfg.threadlocal.manager threadlocal data structure (this is the case when there is no "current request" or we're not in the midst of a r.b.testing.setUp-bounded unit test), the .get method of the manager returns a data structure containing a global registry. In previous releases, this function returned the global Zope "base" registry: the result of zope.component.getGlobalSiteManager, which is an instance of the zope.component.registry.Component class. In this release, however, the global registry returns a globally importable instance of the repoze.bfg.registry.Registry class. This registry instance can always be imported as repoze.bfg.registry.global_registry.

    Effectively, this means that when you call repoze.bfg.threadlocal.get_current_registry when no request or setUp bounded unit test is in effect, you will always get back the global registry that lives in repoze.bfg.registry.global_registry. It also means that repoze.bfg APIs that call get_current_registry will use this registry.

    This change was made because repoze.bfg now expects the registry it uses to have a slightly different API than a bare instance of zope.component.registry.Components.

  • View registration no longer registers a repoze.bfg.interfaces.IViewPermission adapter (it is no longer checked by the framework; since 1.1, views have been responsible for providing their own security).

  • The repoze.bfg.router.make_app callable no longer accepts the authentication_policy nor the authorization_policy arguments. This feature was deprecated in version 1.0 and has been removed.

  • Obscure: the machinery which configured views with a request_type and a route_name would ignore the request interface implied by route_name registering a view only for the interface implied by request_type. In the unlikely event that you were trying to use these two features together, the symptom would have been that views that named a request_type but which were also associated with routes were not found when the route matched. Now if a view is configured with both a request_type and a route_name, an error is raised.

  • The route ZCML directive now no longer accepts the request_type or view_request_type attributes. These attributes didn't actually work in any useful way (see entry above this one).

  • Because the repoze.bfg package now includes implementations of the adapter, subscriber and utility ZCML directives, it is now an error to have <include package="repoze.zcml" file="meta.zcml"/> in the ZCML of a repoze.bfg application. A ZCML conflict error will be raised if your ZCML does so. This shouldn't be an issue for "normal" installations; it has always been the responsibility of the repoze.bfg.includes ZCML to include this file in the past; it now just doesn't.

  • The repoze.bfg.testing.zcml_configure API was removed. Use the Configurator.load_zcml API instead.

廃止

  • The repoze.bfg.router.make_app function is now nominally deprecated. Its import and usage does not throw a warning, nor will it probably ever disappear. However, using a repoze.bfg.configuration.Configurator class is now the preferred way to generate a WSGI application.

    Note that make_app calls zope.component.getSiteManager.sethook( repoze.bfg.threadlocal.get_current_registry) on the caller's behalf, hooking ZCA global API lookups, for backwards compatibility purposes. If you disuse make_app, your calling code will need to perform this call itself, at least if your application uses the ZCA global API (getSiteManager, getAdapter, etc).

依存関係

  • A dependency on the martian package has been removed (its functionality is replaced internally).
  • A dependency on the repoze.zcml package has been removed (its functionality is replaced internally).

1.1.1 (2009-11-21)

バグの修正

  • "Hybrid mode" applications (applications which explicitly used traversal after url dispatch via <route> paths containing the *traverse element) were broken in 1.1-final and all 1.1 alpha and beta releases. Views registered without a route_name route shadowed views registered with a route_name inappropriately.

1.1 (2009-11-15)

内部

  • Remove dead IRouteRequirement interface from repoze.bfg.zcml module.

ドキュメンテーション

  • Improve the "Extending an Existing Application" narrative chapter.
  • Add more sections to the "Defending Design" chapter.

1.1b4 (2009-11-12)

バグの修正

  • Use alsoProvides in the urldispatch module to attach an interface to the request rather than directlyProvides to avoid disturbing interfaces set in a NewRequest event handler.

ドキュメンテーション

  • Move 1.0.1 and previous changelog to HISTORY.txt.
  • Add examples to repoze.bfg.url.model_url docstring.
  • Add "Defending BFG Design" chapter to frontpage docs.

Templates

  • Remove ez_setup.py and its import from all paster templates, samples, and tutorials for distribute compatibility. The documentation already explains how to install virtualenv (which will include some setuptools package), so these files, imports and usages were superfluous.

廃止

  • The options kw arg to the repoze.bfg.router.make_app function is deprecated. In its place is the keyword argument settings. The options keyword continues to work, and a deprecation warning is not emitted when it is detected. However, the paster templates, code samples, and documentation now make reference to settings rather than options. This change/deprecation was mainly made for purposes of clarity and symmetry with the get_settings() API and dicussions of "settings" in various places in the docs: we want to use the same name to refer to the same thing everywhere.

1.1b3 (2009-11-06)

特徴

  • repoze.bfg.testing.registerRoutesMapper testing facility added. This testing function registers a routes "mapper" object in the registry, for tests which require its presence. This function is documented in the repoze.bfg.testing API documentation.

バグの修正

  • Compound statements that used an assignment entered into in an interactive IPython session invoked via paster bfgshell no longer fail to mutate the shell namespace correctly. For example, this set of statements used to fail:

    In [2]: def bar(x): return x
      ...:
    In [3]: list(bar(x) for x in 'abc')
    Out[3]: NameError: 'bar'
    

    In this release, the bar function is found and the correct output is now sent to the console. Thanks to Daniel Holth for the patch.

  • The bfgshell command did not function properly; it was still expecting to be able to call the root factory with a bare environ rather than a request object.

後方の非互換性

  • The repoze.bfg.scripting.get_root function now expects a request object as its second argument rather than an environ.

1.1b2 (2009-11-02)

バグの修正

  • Prevent PyPI installation failure due to easy_install trying way too hard to guess the best version of Paste. When easy_install pulls from PyPI it reads links off various pages to determine "more up to date" versions. It incorrectly picks up a link for an ancient version of a package named "Paste-Deploy-0.1" (note the dash) when trying to find the "Paste" distribution and somehow believes it's the latest version of "Paste". It also somehow "helpfully" decides to check out a version of this package from SVN. We pin the Paste dependency version to a version greater than 1.7 to work around this easy_install bug.

ドキュメンテーション

  • Fix "Hybrid" narrative chapter: stop claiming that <view> statements that mention a route_name need to come afer (in XML order) the <route> statement which creates the route. This hasn't been true since 1.1a1.
  • "What's New in repoze.bfg 1.1" document added to narrative documentation.

特徴

  • Add a new event type: repoze.bfg.events.AfterTraversal. Events of this type will be sent after traversal is completed, but before any view code is invoked. Like repoze.bfg.events.NewRequest, This event will have a single attribute: request representing the current request. Unlike the request attribute of repoze.bfg.events.NewRequest however, during an AfterTraversal event, the request object will possess attributes set by the traverser, most notably context, which will be the context used when a view is found and invoked. The interface repoze.bfg.events.IAfterTraversal can be used to subscribe to the event. For example:

    <subscriber for="repoze.bfg.interfaces.IAfterTraversal"
                handler="my.app.handle_after_traverse"/>
    

    Like any framework event, a subscriber function should expect one parameter: event.

依存関係

  • Rather than depending on chameleon.core and chameleon.zpt distributions individually, depend on Malthe's repackaged Chameleon distribution (which includes both chameleon.core and chameleon.zpt).

1.1b1 (2009-11-01)

バグの修正

  • The routes root factory called route factories and the default route factory with an environ rather than a request. One of the symptoms of this bug: applications generated using the bfg_zodb paster template in 1.1a9 did not work properly.
  • Reinstate renderer alias for view_renderer in the <route> ZCML directive (in-the-wild 1.1a bw compat).
  • bfg_routesalchemy paster template: change <route> declarations: rename renderer attribute to view_renderer.
  • Header values returned by the authtktauthenticationpolicy remember and forget methods would be of type unicode. This violated the WSGI spec, causing a TypeError to be raised when these headers were used under mod_wsgi.
  • If a BFG app that had a route matching the root URL was mounted under a path in modwsgi, ala WSGIScriptAlias /myapp /Users/chrism/projects/modwsgi/env/bfg.wsgi, the home route (a route with the path of '/' or '') would not match when the path /myapp was visited (only when the path /myapp/ was visited). This is now fixed: if the urldispatch root factory notes that the PATH_INFO is empty, it converts it to a single slash before trying to do matching.

ドキュメンテーション

  • In <route> declarations in tutorial ZCML, rename renderer attribute to view_renderer (fwd compat).
  • Fix various tutorials broken by 1.1a9 <route> directive changes.

内部

  • Deal with a potential circref in the traversal module.

1.1a9 (2009-10-31)

バグの修正

  • An incorrect ZCML conflict would be encountered when the request_param predicate attribute was used on the ZCML view directive if any two otherwise same-predicated views had the combination of a predicate value with an = sign and one without (e.g. a vs. a=123).

特徴

  • In previous versions of BFG, the "root factory" (the get_root callable passed to make_app or a function pointed to by the factory attribute of a route) was called with a "bare" WSGI environment. In this version, and going forward, it will be called with a request object. The request object passed to the factory implements dictionary-like methods in such a way that existing root factory code which expects to be passed an environ will continue to work.
  • The __call__ of a plugin "traverser" implementation (registered as an adapter for ITraverser or ITraverserFactory) will now receive a request as the single argument to its __call__ method. In previous versions it was passed a WSGI environ object. The request object passed to the factory implements dictionary-like methods in such a way that existing traverser code which expects to be passed an environ will continue to work.
  • The ZCML route directive's attributes xhr, request_method, path_info, request_param, header and accept are now route predicates rather than view predicates. If one or more of these predicates is specified in the route configuration, all of the predicates must return true for the route to match a request. If one or more of the route predicates associated with a route returns False when checked during a request, the route match fails, and the next match in the routelist is tried. This differs from the previous behavior, where no route predicates existed and all predicates were considered view predicates, because in that scenario, the next route was not tried.

ドキュメンテーション

  • Various changes were made to narrative and API documentation supporting the change from passing a request rather than an environ to root factories and traversers.

内部

  • The request implements dictionary-like methods that mutate and query the WSGI environ. This is only for the purpose of backwards compatibility with root factories which expect an environ rather than a request.
  • The repoze.bfg.request.create_route_request_factory function, which returned a request factory was removed in favor of a repoze.bfg.request.route_request_interface function, which returns an interface.
  • The repoze.bfg.request.Request class, which is a subclass of webob.Request now defines its own __setattr__, __getattr__ and __delattr__ methods, which override the default WebOb behavior. The default WebOb behavior stores attributes of the request in self.environ['webob.adhoc_attrs'], and retrieves them from that dictionary during a __getattr__. This behavior was undesirable for speed and "expectation" reasons. Now attributes of the request are stored in request.__dict__ (as you otherwise might expect from an object that did not override these methods).
  • The router no longer calls repoze.bfg.traversal._traverse and does its work "inline" (speed).
  • Reverse the order in which the router calls the request factory and the root factory. The request factory is now called first; the resulting request is passed to the root factory.
  • The repoze.bfg.request.request_factory function has been removed. Its functionality is no longer required.
  • The "routes root factory" that wraps the default root factory when there are routes mentioned in the configuration now attaches an interface to the request via zope.interface.directlyProvides. This replaces logic in the (now-gone) repoze.bfg.request.request_factory function.
  • The route and view ZCML directives now register an interface as a named utility (retrieved from repoze.bfg.request.route_request_interface) rather than a request factory (the previous return value of the now-missing repoze.bfg.request.create_route_request_factory.
  • The repoze.bfg.functional module was renamed to repoze.bfg.compat.

後方の非互換性

  • Explicitly revert the feature introduced in 1.1a8: where the name root is available as an attribute of the request before a NewRequest event is emitted. This makes some potential future features impossible, or at least awkward (such as grouping traversal and view lookup into a single adapter lookup).
  • The containment, attr and renderer attributes of the route ZCML directive were removed.

1.1a8 (2009-10-27)

特徴

  • Add path_info view configuration predicate.
  • paster bfgshell now supports IPython if it's available for import. Thanks to Daniel Holth for the initial patch.
  • Add repoze.bfg.testing.registerSettings API, which is documented in the "repoze.bfg.testing" API chapter. This allows for registration of "settings" values obtained via repoze.bfg.settings.get_settings() for use in unit tests.
  • The name root is available as an attribute of the request slightly earlier now (before a NewRequest event is emitted). root is the result of the application "root factory".
  • Added max_age parameter to authtktauthenticationpolicy ZCML directive. If this value is set, it must be an integer representing the number of seconds which the auth tkt cookie will survive. Mainly, its existence allows the auth_tkt cookie to survive across browser sessions.

バグの修正

  • Fix bug encountered during "scan" (when <scan ..> directive is used in ZCML) introduced in 1.1a7. Symptom: AttributeError: object has no attribute __provides__ raised at startup time.
  • The reissue_time argument to the authtktauthenticationpolicy ZCML directive now actually works. When it is set to an integer value, an authticket set-cookie header is appended to the response whenever a request requires authentication and 'now' minus the authticket's timestamp is greater than reissue_time seconds.

ドキュメンテーション

  • Add a chapter titled "Request and Response" to the narrative documentation, content cribbed from the WebOb documentation.
  • Call out predicate attributes of ZCML directive within "Views" chapter.
  • Fix route_url documentation (_query argument documented as query and _anchor argument documented as anchor).

後方の非互換性

  • The authtkt authentication policy remember method now no longer honors token or userdata keyword arguments.

内部

  • Change how bfg_view decorator works when used as a class method decorator. In 1.1a7, the``scan``directive actually tried to grope every class in scanned package at startup time, calling dir against each found class, and subsequently invoking getattr against each thing found by dir to see if it was a method. This led to some strange symptoms (e.g. AttributeError: object has no attribute __provides__), and was generally just a bad idea. Now, instead of groping classes for methods at startup time, we just cause the bfg_view decorator itself to populate the method's class' __dict__ when it is used as a method decorator. This also requires a nasty _getframe thing but it's slightly less nasty than the startup time groping behavior. This is essentially a reversion back to 1.1a6 "grokking" behavior plus some special magic for using the bfg_view decorator as method decorator inside the bfg_view class itself.
  • The router now checks for a global_response_headers attribute of the request object before returning a response. If this value exists, it is presumed to be a sequence of two-tuples, representing a set of headers to append to the 'normal' response headers. This feature is internal, rather than exposed externally, because it's unclear whether it will stay around in the long term. It was added to support the reissue_time feature of the authtkt authentication policy.
  • The interface ITraverserFactory is now just an alias for ITraverser.

1.1a7 (2009-10-18)

特徴

  • More than one @bfg_view decorator may now be stacked on top of any number of others. Each invocation of the decorator registers a single view configuration. For instance, the following combination of decorators and a function will register two view configurations for the same view callable:

    from repoze.bfg.view import bfg_view
    
    @bfg_view(name='edit')
    @bfg_view(name='change')
    def edit(context, request):
        pass
    

    This makes it possible to associate more than one view configuration with a single callable without requiring any ZCML.

  • The @bfg_view decorator can now be used against a class method:

    from webob import Response
    from repoze.bfg.view import bfg_view
    
    class MyView(object):
        def __init__(self, context, request):
            self.context = context
            self.request = request
    
        @bfg_view(name='hello')
        def amethod(self):
            return Response('hello from %s!' % self.context)
    

    When the bfg_view decorator is used against a class method, a view is registered for the class (it's a "class view" where the "attr" happens to be the name of the method it is attached to), so the class it's defined within must have a suitable constructor: one that accepts context, request or just request.

ドキュメンテーション

  • Added Changing the Traverser and Changing How :mod:`repoze.bfg.url.model_url` Generates a URL to the "Hooks" narrative chapter of the docs.

内部

  • Remove ez_setup.py and imports of it within setup.py. In the new world, and as per virtualenv setup instructions, people will already have either setuptools or distribute.

1.1a6 (2009-10-15)

特徴

  • Add xhr, accept, and header view configuration predicates to ZCML view declaration, ZCML route declaration, and bfg_view decorator. See the Views narrative documentation chapter for more information about these predicates.
  • Add setUp and tearDown functions to the repoze.bfg.testing module. Using setUp in a test setup and tearDown in a test teardown is now the recommended way to do component registry setup and teardown. Previously, it was recommended that a single function named repoze.bfg.testing.cleanUp be called in both the test setup and tear down. repoze.bfg.testing.cleanUp still exists (and will exist "forever" due to its widespread use); it is now just an alias for repoze.bfg.testing.setUp and is nominally deprecated.
  • The BFG component registry is now available in view and event subscriber code as an attribute of the request ie. request.registry. This fact is currently undocumented except for this note, because BFG developers never need to interact with the registry directly anywhere else.
  • The BFG component registry now inherits from dict, meaning that it can optionally be used as a simple dictionary. Component registrations performed against it via e.g. registerUtility, registerAdapter, and similar API methods are kept in a completely separate namespace than its dict members, so using the its component API methods won't effect the keys and values in the dictionary namespace. Likewise, though the component registry "happens to be" a dictionary, use of mutating dictionary methods such as __setitem__ will have no influence on any component registrations made against it. In other words, the registry object you obtain via e.g. repoze.bfg.threadlocal.get_current_registry or request.registry happens to be both a component registry and a dictionary, but using its component-registry API won't impact data added to it via its dictionary API and vice versa. This is a forward compatibility move based on the goals of "marco".
  • Expose and document repoze.bfg.testing.zcml_configure API. This function populates a component registry from a ZCML file for testing purposes. It is documented in the "Unit and Integration Testing" chapter.

ドキュメンテーション

  • Virtual hosting narrative docs chapter updated with info about mod_wsgi.
  • Point all index URLs at the literal 1.1 index (this alpha cycle may go on a while).
  • Various tutorial test modules updated to use repoze.bfg.testing.setUp and repoze.bfg.testing.tearDown methods in order to encourage this as best practice going forward.
  • Added "Creating Integration Tests" section to unit testing narrative documentation chapter. As a result, the name of the unittesting chapter is now "Unit and Integration Testing".

後方の非互換性

  • Importing getSiteManager and get_registry from repoze.bfg.registry is no longer supported. These imports were deprecated in repoze.bfg 1.0. Import of getSiteManager should be done as from zope.component import getSiteManager. Import of get_registry should be done as from repoze.bfg.threadlocal import get_current_registry. This was done to prevent a circular import dependency.
  • Code bases which alternately invoke both zope.testing.cleanup.cleanUp and repoze.bfg.testing.cleanUp (treating them equivalently, using them interchangeably) in the setUp/tearDown of unit tests will begin to experience test failures due to lack of test isolation. The "right" mechanism is repoze.bfg.testing.cleanUp (or the combination of repoze.bfg.testing.setUp and repoze.bfg.testing.tearDown). but a good number of legacy codebases will use zope.testing.cleanup.cleanUp instead. We support zope.testing.cleanup.cleanUp but not in combination with repoze.bfg.testing.cleanUp in the same codebase. You should use one or the other test cleanup function in a single codebase, but not both.

内部

  • Created new repoze.bfg.configuration module which assumes responsibilities previously held by the repoze.bfg.registry and repoze.bfg.router modules (avoid a circular import dependency).
  • The result of the zope.component.getSiteManager function in unit tests set up with repoze.bfg.testing.cleanUp or repoze.bfg.testing.setUp will be an instance of repoze.bfg.registry.Registry instead of the global zope.component.globalregistry.base registry. This also means that the threadlocal ZCA API functions such as getAdapter and getUtility as well as internal BFG machinery (such as model_url and route_url) will consult this registry within unit tests. This is a forward compatibility move based on the goals of "marco".
  • Removed repoze.bfg.testing.addCleanUp function and associated module-scope globals. This was never an API.

1.1a5 (2009-10-10)

ドキュメンテーション

  • Change "Traversal + ZODB" and "URL Dispatch + SQLAlchemy" Wiki tutorials to make use of the new-to-1.1 "renderer" feature (return dictionaries from all views).
  • Add tests to the "URL Dispatch + SQLAlchemy" tutorial after the "view" step.
  • Added a diagram of model graph traversal to the "Traversal" narrative chapter of the documentation.
  • An exceptions API chapter was added, documenting the new repoze.bfg.exceptions module.
  • Describe "request-only" view calling conventions inside the urldispatch narrative chapter, where it's most helpful.
  • Add a diagram which explains the operation of the BFG router to the "Router" narrative chapter.

特徴

  • Add a new repoze.bfg.testing API: registerRoute, for registering routes to satisfy calls to e.g. repoze.bfg.url.route_url in unit tests.
  • The notfound and forbidden ZCML directives now accept the following addtional attributes: attr, renderer, and wrapper. These have the same meaning as they do in the context of a ZCML view directive.
  • For behavior like Django's APPEND_SLASH=True, use the repoze.bfg.view.append_slash_notfound_view view as the Not Found view in your application. When this view is the Not Found view (indicating that no view was found), and any routes have been defined in the configuration of your application, if the value of PATH_INFO does not already end in a slash, and if the value of PATH_INFO plus a slash matches any route's path, do an HTTP redirect to the slash-appended PATH_INFO. Note that this will lose POST data information (turning it into a GET), so you shouldn't rely on this to redirect POST requests.
  • Speed up repoze.bfg.location.lineage slightly.
  • Speed up repoze.bfg.encode.urlencode (nee' repoze.bfg.url.urlencode) slightly.
  • Speed up repoze.bfg.traversal.model_path.
  • Speed up repoze.bfg.traversal.model_path_tuple slightly.
  • Speed up repoze.bfg.traversal.traverse slightly.
  • Speed up repoze.bfg.url.model_url slightly.
  • Speed up repoze.bfg.url.route_url slightly.
  • Sped up repoze.bfg.traversal.ModelGraphTraverser:__call__ slightly.
  • Minor speedup of repoze.bfg.router.Router.__call__.
  • New repoze.bfg.exceptions module was created to house exceptions that were previously sprinkled through various modules.

内部

  • Move repoze.bfg.traversal._url_quote into repoze.bfg.encode as url_quote.

廃止

  • The import of repoze.bfg.view.NotFound is deprecated in favor of repoze.bfg.exceptions.NotFound. The old location still functions, but emits a deprecation warning.
  • The import of repoze.bfg.security.Unauthorized is deprecated in favor of repoze.bfg.exceptions.Forbidden. The old location still functions but emits a deprecation warning. The rename from Unauthorized to Forbidden brings parity to the name of the exception and the system view it invokes when raised.

後方の非互換性

  • We previously had a Unicode-aware wrapper for the urllib.urlencode function named repoze.bfg.url.urlencode which delegated to the stdlib function, but which marshalled all unicode values to utf-8 strings before calling the stdlib version. A newer replacement now lives in repoze.bfg.encode The replacement does not delegate to the stdlib.

    The replacement diverges from the stdlib implementation and the previous repoze.bfg.url url implementation inasmuch as its doseq argument is now a decoy: it always behaves in the doseq=True way (which is the only sane behavior) for speed purposes.

    The old import location (repoze.bfg.url.urlencode) still functions and has not been deprecated.

  • In 0.8a7, the return value expected from an object implementing ITraverserFactory was changed from a sequence of values to a dictionary containing the keys context, view_name, subpath, traversed, virtual_root, virtual_root_path, and root. Until now, old-style traversers which returned a sequence have continued to work but have generated a deprecation warning. In this release, traversers which return a sequence instead of a dictionary will no longer work.

1.1a4 (2009-09-23)

バグの修正

  • On 64-bit Linux systems, views that were members of a multiview (orderings of views with predicates) were not evaluated in the proper order. Symptom: in a configuration that had two views with the same name but one with a request_method=POST predicate and one without, the one without the predicate would be called unconditionally (even if the request was a POST request). Thanks much to Sebastien Douche for providing the buildbots that pointed this out.

ドキュメンテーション

  • Added a tutorial which explains how to use repoze.session (ZODB-based sessions) in a ZODB-based repoze.bfg app.
  • Added a tutorial which explains how to add ZEO to a ZODB-based repoze.bfg application.
  • Added a tutorial which explains how to run a repoze.bfg application under mod_wsgi. See "Running a repoze.bfg Application under mod_wsgi" in the tutorials section of the documentation.

特徴

  • Add a repoze.bfg.url.static_url API which is capable of generating URLs to static resources defined by the <static> ZCML directive. See the "Views" narrative chapter's section titled "Generating Static Resource URLs" for more information.
  • Add a string renderer. This renderer converts a non-Response return value of any view callble into a string. It is documented in the "Views" narrative chapter.
  • Give the route ZCML directive the view_attr and view_renderer parameters (bring up to speed with 1.1a3 features). These can also be spelled as attr and renderer.

後方の非互換性

  • An object implementing the IRenderer interface (and ITemplateRenderer`, which is a subclass of ``IRenderer) must now accept an extra system argument in its __call__ method implementation. Values computed by the system (as opposed to by the view) are passed by the system in the system parameter, which will always be a dictionary. Keys in the dictionary include: view (the view object 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). Previously only ITemplateRenderers received system arguments as elements inside the main value dictionary.

内部

  • The way bfg_view declarations are scanned for has been modified. This should have no external effects.
  • Speed: do not register an ITraverserFactory in configure.zcml; instead rely on queryAdapter and a manual default to ModelGraphTraverser.
  • Speed: do not register an IContextURL in configure.zcml; instead rely on queryAdapter and a manual default to TraversalContextURL.
  • General speed microimprovements for helloworld benchmark: replace try/excepts with statements which use 'in' keyword.

1.1a3 (2009-09-16)

ドキュメンテーション

  • The "Views" narrative chapter in the documentation has been updated extensively to discuss "renderers".

特徴

  • A renderer attribute has been added to view configurations, replacing the previous (1.1a2) version's template attribute. A "renderer" is an object which accepts the return value of a view and converts it to a string. This includes, but is not limited to, templating systems.
  • A new interface named IRenderer was added. The existing interface, ITemplateRenderer now derives from this new interface. This interface is internal.
  • A new interface named IRendererFactory was added. An existing interface named ITemplateRendererFactory now derives from this interface. This interface is internal.
  • The view attribute of the view ZCML directive is no longer required if the ZCML directive also has a renderer attribute. This is useful when the renderer is a template renderer and no names need be passed to the template at render time.
  • A new zcml directive renderer has been added. It is documented in the "Views" narrative chapter of the documentation.
  • A ZCML view directive (and the associated bfg_view decorator) can now accept a "wrapper" value. If a "wrapper" value is supplied, it is the value of a separate view's name attribute. When a view with a wrapper attribute is rendered, the "inner" view is first rendered normally. Its body is then attached to the request as "wrapped_body", and then a wrapper view name is looked up and rendered (using repoze.bfg.render_view_to_response), passed the request and the context. The wrapper view is assumed to do something sensible with request.wrapped_body, usually inserting its structure into some other rendered template. This feature makes it possible to specify (potentially nested) "owrap" relationships between views using only ZCML or decorators (as opposed always using ZPT METAL and analogues to wrap view renderings in outer wrappers).

依存関係

  • When used under Python < 2.6, BFG now has an installation time dependency on the simplejson package.

廃止

  • The repoze.bfg.testing.registerDummyRenderer API has been deprecated in favor of repoze.bfg.testing.registerTemplateRenderer. A deprecation warning is not issued at import time for the former name; it will exist "forever"; its existence has been removed from the documentation, however.
  • The repoze.bfg.templating.renderer_from_cache function has been moved to repoze.bfg.renderer.template_renderer_factory. This was never an API, but code in the wild was spotted that used it. A deprecation warning is issued at import time for the former.

後方の非互換性

  • The ITemplateRenderer interface has been changed. Previously its __call__ method accepted **kw. It now accepts a single positional parameter named kw (REVISED: it accepts two positional parameters as of 1.1a4: value and system). This is mostly an internal change, but it was exposed in APIs in one place: if you've used the repoze.bfg.testing.registerDummyRenderer API in your tests with a custom "renderer" argument with your own renderer implementation, you will need to change that renderer implementation to accept kw instead of **kw in its __call__ method (REVISED: make it accept value and system positional arguments as of 1.1a4).
  • The ITemplateRendererFactory interface has been changed. Previously its __call__ method accepted an auto_reload keyword parameter. Now its __call__ method accepts no keyword parameters. Renderers are now themselves responsible for determining details of auto-reload. This is purely an internal change. This interface was never external.
  • The template_renderer ZCML directive introduced in 1.1a2 has been removed. It has been replaced by the renderer directive.
  • The previous release (1.1a2) added a view configuration attribute named template. In this release, the attribute has been renamed to renderer. This signifies that the attribute is more generic: it can now be not just a template name but any renderer name (ala json).
  • In the previous release (1.1a2), the Chameleon text template renderer was used if the system didn't associate the template view configuration value with a filename with a "known" extension. In this release, you must use a renderer attribute which is a path that ends with a .txt extension (e.g. templates/foo.txt) to use the Chameleon text renderer.

1.1a2 (2009-09-14)

特徴

  • A ZCML view directive (and the associated bfg_view decorator) can now accept an "attr" value. If an "attr" value is supplied, it is considered a method named of the view object to be called when the response is required. This is typically only good for views that are classes or instances (not so useful for functions, as functions typically have no methods other than __call__).
  • A ZCML view directive (and the associated bfg_view decorator) can now accept a "template" value. If a "template" value is supplied, and the view callable returns a dictionary, the associated template is rendered with the dictionary as keyword arguments. See the section named "Views That Have a template" in the "Views" narrative documentation chapter for more information.

1.1a1 (2009-09-06)

バグの修正

  • "tests" module removed from the bfg_alchemy paster template; these tests didn't work.
  • Bugfix: the discriminator for the ZCML "route" directive was incorrect. It was possible to register two routes that collided without the system spitting out a ConfigurationConflictError at startup time.

特徴

  • Feature addition: view predicates. These are exposed as the request_method, request_param, and containment attributes of a ZCML view declaration, or the respective arguments to a @bfg_view decorator. View predicates can be used to register a view for a more precise set of environment parameters than was previously possible. For example, you can register two views with the same name with different request_param attributes. If the request.params dict contains 'foo' (request_param="foo"), one view might be called; if it contains 'bar' (request_param="bar"), another view might be called. request_param can also name a key/value pair ala foo=123. This will match only when the foo key is in the request.params dict and it has the value '123'. This particular example makes it possible to write separate view functions for different form submissions. The other predicates, containment and request_method work similarly. containment is a view predicate that will match only when the context's graph lineage has an object possessing a particular class or interface, for example. request_method is a view predicate that will match when the HTTP REQUEST_METHOD equals some string (eg. 'POST').
  • The @bfg_view decorator now accepts three additional arguments: request_method, request_param, and containment. request_method is used when you'd like the view to match only a request with a particular HTTP REQUEST_METHOD; a string naming the REQUEST_METHOD can also be supplied as request_type for backwards compatibility. request_param is used when you'd like a view to match only a request that contains a particular request.params key (with or without a value). containment is used when you'd like to match a request that has a context that has some class or interface in its graph lineage. These are collectively known as "view predicates".
  • The route ZCML directive now honors view_request_method, view_request_param and view_containment attributes, which pass along these values to the associated view if any is provided. Additionally, the request_type attribute can now be spelled as view_request_type, and permission can be spelled as view_permission. Any attribute which starts with view_ can now be spelled without the view_ prefix, so view_for can be spelled as for now, etc. Both forms are documented in the urldispatch narraitve documentation chapter.
  • The request_param ZCML view directive attribute (and its bfg_view decorator cousin) can now specify both a key and a value. For example, request_param="foo=123" means that the foo key must have a value of 123 for the view to "match".
  • Allow repoze.bfg.traversal.find_interface API to use a class object as the argument to compare against the model passed in. This means you can now do find_interface(model, SomeClass) and the first object which is found in the lineage which has SomeClass as its class (or the first object found which has SomeClass as any of its superclasses) will be returned.
  • Added static ZCML directive which registers a route for a view that serves up files in a directory. See the "Views" narrative documentation chapter's "Serving Static Resources Using a ZCML Directive" section for more information.
  • The repoze.bfg.view.static class now accepts a string as its first argument ("root_dir") that represents a package-relative name e.g. somepackage:foo/bar/static. This is now the preferred mechanism for spelling package-relative static paths using this class. A package_name keyword argument has been left around for backwards compatibility. If it is supplied, it will be honored.
  • The API repoze.bfg.testing.registerView now takes a permission argument. Use this instead of using repoze.bfg.testing.registerViewPermission.
  • The ordering of route declarations vs. the ordering of view declarations that use a "route_name" in ZCML no longer matters. Previously it had been impossible to use a route_name from a route that had not yet been defined in ZCML (order-wise) within a "view" declaration.
  • The repoze.bfg router now catches both repoze.bfg.security.Unauthorized and repoze.bfg.view.NotFound exceptions while rendering a view. When the router catches an Unauthorized, it returns the registered forbidden view. When the router catches a NotFound, it returns the registered notfound view.

内部

  • Change urldispatch internals: Route object is now constructed using a path, a name, and a factory instead of a name, a matcher, a generator, and a factory.
  • Move (non-API) default_view, default_forbidden_view, and default_notfound_view functions into the repoze.bfg.view module (moved from repoze.bfg.router).
  • Removed ViewPermissionFactory from repoze.bfg.security. View permission checking is now done by registering and looking up an ISecuredView.
  • The static ZCML directive now uses a custom root factory when constructing a route.
  • The interface IRequestFactories was removed from the repoze.bfg.interfaces module. This interface was never an API.
  • The function named named_request_factories and the data structure named DEFAULT_REQUEST_FACTORIES have been removed from the repoze.bfg.request module. These were never APIs.
  • The IViewPermissionFactory interface has been removed. This was never an API.

ドキュメンテーション

  • Request-only-convention examples in the "Views" narrative documentation were broken.
  • Fixed documentation bugs related to forget and remember in security API docs.
  • Fixed documentation for repoze.bfg.view.static (in narrative Views chapter).

廃止

  • The API repoze.bfg.testing.registerViewPermission has been deprecated.

後方の非互換性

  • The interfaces IPOSTRequest, IGETRequest, IPUTRequest, IDELETERequest, and IHEADRequest have been removed from the repoze.bfg.interfaces module. These were not documented as APIs post-1.0. Instead of using one of these, use a request_method ZCML attribute or request_method bfg_view decorator parameter containing an HTTP method name (one of GET, POST, HEAD, PUT, DELETE) instead of one of these interfaces if you were using one explicitly. Passing a string in the set (GET, HEAD, PUT, POST, DELETE) as a request_type argument will work too. Rationale: instead of relying on interfaces attached to the request object, BFG now uses a "view predicate" to determine the request type.

  • Views registered without the help of the ZCML view directive are now responsible for performing their own authorization checking.

  • The registry_manager backwards compatibility alias importable from "repoze.bfg.registry", deprecated since repoze.bfg 0.9 has been removed. If you are tring to use the registry manager within a debug script of your own, use a combination of the "repoze.bfg.paster.get_app" and "repoze.bfg.scripting.get_root" APIs instead.

  • The INotFoundAppFactory interface has been removed; it has been deprecated since repoze.bfg 0.9. If you have something like the following in your configure.zcml:

    <utility provides="repoze.bfg.interfaces.INotFoundAppFactory"
             component="helloworld.factories.notfound_app_factory"/>
    

    Replace it with something like:

    <notfound
        view="helloworld.views.notfound_view"/>
    

    See "Changing the Not Found View" in the "Hooks" chapter of the documentation for more information.

  • The IUnauthorizedAppFactory interface has been removed; it has been deprecated since repoze.bfg 0.9. If you have something like the following in your configure.zcml:

    <utility provides="repoze.bfg.interfaces.IUnauthorizedAppFactory"
             component="helloworld.factories.unauthorized_app_factory"/>
    

    Replace it with something like:

    <forbidden
        view="helloworld.views.forbidden_view"/>
    

    See "Changing the Forbidden View" in the "Hooks" chapter of the documentation for more information.

  • ISecurityPolicy-based security policies, deprecated since repoze.bfg 0.9, have been removed. If you have something like this in your configure.zcml, it will no longer work:

    <utility
      provides="repoze.bfg.interfaces.ISecurityPolicy"
      factory="repoze.bfg.security.RemoteUserInheritingACLSecurityPolicy"
     />
    

    If ZCML like the above exists in your application, you will receive an error at startup time. Instead of the above, you'll need something like:

    <remoteuserauthenticationpolicy/>
    <aclauthorizationpolicy/>
    

    This is just an example. See the "Security" chapter of the repoze.bfg documentation for more information about configuring security policies.

  • Custom ZCML directives which register an authentication or authorization policy (ala "authtktauthenticationpolicy" or "aclauthorizationpolicy") should register the policy "eagerly" in the ZCML directive instead of from within a ZCML action. If an authentication or authorization policy is not found in the component registry by the view machinery during deferred ZCML processing, view security will not work as expected.

1.0.1 (2009-07-22)

  • Added support for has_resource, resource_isdir, and resource_listdir to the resource "OverrideProvider"; this fixes a bug with a symptom that a file could not be overridden in a resource directory unless a file with the same name existed in the original directory being overridden.
  • Fixed documentation bug showing invalid test for values from the matchdict: they are stored as attributes of the Article, rather than subitems.
  • Fixed documentation bug showing wrong environment key for the matchdict produced by the matching route.
  • Added a workaround for a bug in Python 2.6, 2.6.1, and 2.6.2 having to do with a recursion error in the mimetypes module when trying to serve static files from Paste's FileApp: http://bugs.python.org/issue5853. Symptom: File "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type return guess_type(url, strict) RuntimeError: maximum recursion depth exceeded. Thanks to Armin Ronacher for identifying the symptom and pointing out a fix.
  • Minor edits to tutorials for accuracy based on feedback.
  • Declared Paste and PasteDeploy dependencies.

1.0 (2009-07-05)

  • Retested and added some content to GAE tutorial.
  • Edited "Extending" narrative docs chapter.
  • Added "Deleting the Database" section to the "Defining Models" chapter of the traversal wiki tutorial.
  • Spell checking of narratives and tutorials.

1.0b2 (2009-07-03)

  • remoteuserauthenticationpolicy ZCML directive didn't work without an environ_key directive (didn't match docs).
  • Fix configure_zcml filespec check on Windows. Previously if an absolute filesystem path including a drive letter was passed as filename (or as configure_zcml in the options dict) to repoze.bfg.router.make_app, it would be treated as a package:resource_name specification.
  • Fix inaccuracies and import errors in bfgwiki (traversal+ZODB) and bfgwiki2 (urldispatch+SA) tutorials.
  • Use bfgsite index for all tutorial setup.cfg files.
  • Full documentation grammar/style/spelling audit.

1.0b1 (2009-07-02)

特徴

  • Allow a Paste config file (configure_zcml) value or an environment variable (BFG_CONFIGURE_ZCML) to name a ZCML file (optionally package-relative) that will be used to bootstrap the application. Previously, the integrator could not influence which ZCML file was used to do the boostrapping (only the original application developer could do so).

ドキュメンテーション

  • Added a "Resources" chapter to the narrative documentation which explains how to override resources within one package from another package.
  • Added an "Extending" chapter to the narrative documentation which explains how to extend or modify an existing BFG application using another Python package and ZCML.

1.0a9 (2009-07-01)

特徴

  • Make it possible to pass strings in the form "package_name:relative/path" to APIs like render_template, render_template_to_response, and get_template. Sometimes the package in which a caller lives is a direct namespace package, so the module which is returned is semi-useless for navigating from. In this way, the caller can control the horizontal and vertical of where things get looked up from.

1.0a8 (2009-07-01)

廃止

  • Deprecate the authentication_policy and authorization_policy arguments to repoze.bfg.router.make_app. Instead, developers should use the various authentication policy ZCML directives (repozewho1authenticationpolicy, remoteuserauthenticationpolicy and authtktauthenticationpolicy) and the aclauthorizationpolicy` authorization policy directive as described in the changes to the "Security" narrative documenation chapter and the wiki tutorials.

特徴

  • Add three new ZCML directives which configure authentication policies:
    • repozewho1authenticationpolicy
    • remoteuserauthenticationpolicy
    • authtktauthenticationpolicy
  • Add a new ZCML directive which configures an ACL authorization policy named aclauthorizationpolicy.

バグの修正

  • Bug fix: when a repoze.bfg.resource.PackageOverrides class was instantiated, and the package it was overriding already had a __loader__ attribute, it would fail at startup time, even if the __loader__ attribute was another PackageOverrides instance. We now replace any __loader__ that is also a PackageOverrides instance. Symptom: ConfigurationExecutionError: <type 'exceptions.TypeError'>: Package <module 'karl.views' from '/Users/chrism/projects/osi/bfgenv/src/karl/karl/views/__init__.pyc'> already has a __loader__ (probably a module in a zipped egg).

1.0a7 (2009-06-30)

特徴

  • Add a reload_resources configuration file setting (aka the BFG_RELOAD_RESOURCES environment variable). When this is set to true, the server never needs to be restarted when moving files between directory resource overrides (esp. for templates currently).
  • Add a reload_all configuration file setting (aka the BFG_RELOAD_ALL environment variable) that implies both reload_resources and reload_templates.
  • The static helper view class now uses a PackageURLParser in order to allow for the overriding of static resources (CSS / logo files, etc) using the resource ZCML directive. The PackageURLParser class was added to a (new) static module in BFG; it is a subclass of the StaticURLParser class in paste.urlparser.
  • The repoze.bfg.templating.renderer_from_cache function now checks for the reload_resources setting; if it's true, it does not register a template renderer (it won't use the registry as a template renderer cache).

ドキュメンテーション

  • Add pkg_resources to the glossary.
  • Update the "Environment" docs to note the existence of reload_resources and reload_all.
  • Updated the bfg_alchemy paster template to include two views: the view on the root shows a list of links to records; the view on a record shows the details for that object.

内部

  • Use a colon instead of a tab as the separator between package name and relpath to form the "spec" when register a ITemplateRenderer.
  • Register a repoze.bfg.resource.OverrideProvider as a pkg_resources provider only for modules which are known to have overrides, instead of globally, when a <resource> directive is used (performance).

1.0a6 (2009-06-29)

バグの修正

  • Use caller_package function instead of caller_module function within templating to avoid needing to name the caller module in resource overrides (actually match docs).
  • Make it possible to override templates stored directly in a module with templates in a subdirectory of the same module, stored directly within another module, or stored in a subdirectory of another module (actually match docs).

1.0a5 (2009-06-28)

特徴

  • A new ZCML directive exists named "resource". This ZCML directive allows you to override Chameleon templates within a package (both directories full of templates and individual template files) with other templates in the same package or within another package. This allows you to "fake out" a view's use of a template, causing it to retrieve a different template than the one actually named by a relative path to a call like render_template_to_response('templates/mytemplate.pt'). For example, you can override a template file by doing:

    <resource
      to_override="some.package:templates/mytemplate.pt"
      override_with="another.package:othertemplates/anothertemplate.pt"
     />
    

    The string passed to "to_override" and "override_with" is named a "specification". The colon separator in a specification separates the package name from a package-relative directory name. The colon and the following relative path are optional. If they are not specified, the override attempts to resolve every lookup into a package from the directory of another package. For example:

    <resource
      to_override="some.package"
      override_with="another.package"
     />
    

    Individual subdirectories within a package can also be overridden:

    <resource
      to_override="some.package:templates/"
      override_with="another.package:othertemplates/"
     />
    

    If you wish to override a directory with another directory, you must make sure to attach the slash to the end of both the to_override specification and the override_with specification. If you fail to attach a slash to the end of a specification that points a directory, you will get unexpected results. You cannot override a directory specification with a file specification, and vice versa (a startup error will occur if you try).

    You cannot override a resource with itself (a startup error will occur if you try).

    Only individual package resources may be overridden. Overrides will not traverse through subpackages within an overridden package. This means that if you want to override resources for both some.package:templates, and some.package.views:templates, you will need to register two overrides.

    The package name in a specification may start with a dot, meaning that the package is relative to the package in which the ZCML file resides. For example:

    <resource
      to_override=".subpackage:templates/"
      override_with="another.package:templates/"
     />
    

    Overrides for the same to_overrides specification can be named multiple times within ZCML. Each override_with path will be consulted in the order defined within ZCML, forming an override search path.

    Resource overrides can actually override resources other than templates. Any software which uses the pkg_resources get_resource_filename, get_resource_stream or get_resource_string APIs will obtain an overridden file when an override is used. However, the only built-in facility which uses the pkg_resources API within BFG is the templating stuff, so we only call out template overrides here.

  • Use the pkg_resources API to locate template filenames instead of dead-reckoning using the os.path module.

  • The repoze.bfg.templating module now uses pkg_resources to locate and register template files instead of using an absolute path name.

1.0a4 (2009-06-25)

特徴

  • Cause :segment matches in route paths to put a Unicode-decoded and URL-dequoted value in the matchdict for the value matched. Previously a non-decoded non-URL-dequoted string was placed in the matchdict as the value.
  • Cause *remainder matches in route paths to put a tuple in the matchdict dictionary in order to be able to present Unicode-decoded and URL-dequoted values for the traversal path. Previously a non-decoded non-URL-dequoted string was placed in the matchdict as the value.
  • Add optional max_age keyword value to the remember method of repoze.bfg.authentication.AuthTktAuthenticationPolicy; if this value is passed to remember, the generated cookie will have a corresponding Max-Age value.

ドキュメンテーション

  • Add information to the URL Dispatch narrative documentation about path pattern matching syntax.

バグの修正

  • Make route_url URL-quote segment replacements during generation. Remainder segments are not quoted.

1.0a3 (2009-06-24)

Implementation Changes

  • repoze.bfg no longer relies on the Routes package to interpret URL paths. All known existing path patterns will continue to work with the reimplemented logic, which lives in repoze.bfg.urldispatch. <route> ZCML directives which use certain attributes (uncommon ones) may not work (see "Backwards Incompatibilities" below).

バグの修正

  • model_url when passed a request that was generated as a result of a route match would fail in a call to route.generate.
  • BFG-on-GAE didn't work due to a corner case bug in the fallback Python implementation of threading.local (symptom: "Initialization arguments are not supported"). Thanks to Michael Bernstein for the bug report.

ドキュメンテーション

  • Added a "corner case" explanation to the "Hybrid Apps" chapter explaining what to do when "the wrong" view is matched.
  • Use repoze.bfg.url.route_url API in tutorials rather than Routes url_for API.

特徴

  • Added the repoze.bfg.url.route_url API. This API allows you to generate URLs based on <route> declarations. See the URL Dispatch narrative chapter and the "repoze.bfg.url" module API documentation for more information.

後方の非互換性

  • As a result of disusing Routes, using the Routes url_for API inside a BFG application (as was suggested by previous iterations of tutorials) will no longer work. Use the repoze.bfg.url.route_url method instead.
  • The following attributes on the <route> ZCML directive no longer work: encoding, static, filter, condition_method, condition_subdomain, condition_function, explicit, or subdomains. These were all Routes features.
  • The <route> ZCML directive no longer supports the <requirement> subdirective. This was a Routes feature.

1.0a2 (2009-06-23)

バグの修正

  • The bfg_routesalchemy paster template app tests failed due to a mismatch between test and view signatures.

特徴

  • Add a view_for attribute to the route ZCML directive. This attribute should refer to an interface or a class (ala the for attribute of the view ZCML directive).

ドキュメンテーション

  • Conditional documentation in installation section ("how to install a Python interpreter").

後方の非互換性

  • The callback argument of the repoze.bfg.authentication authentication policies named RepozeWho1AuthenticationPolicy, RemoteUserAuthenticationPolicy, and AuthTktAuthenticationPolicy now must accept two positional arguments: the orginal argument accepted by each (userid or identity) plus a second argument, which will be the current request. Apologies, this is required to service finding groups when there is no "global" database connection.

1.0a1 (2009-06-22)

特徴

  • A new ZCML directive was added named notfound. This ZCML directive can be used to name a view that should be invoked when the request can't otherwise be resolved to a view callable. For example:

    <notfound
        view="helloworld.views.notfound_view"/>
    
  • A new ZCML directive was added named forbidden. This ZCML directive can be used to name a view that should be invoked when a view callable for a request is found, but cannot be invoked due to an authorization failure. For example:

    <forbidden
        view="helloworld.views.forbidden_view"/>
    
  • Allow views to be optionally defined as callables that accept only a request object, instead of both a context and a request (which still works, and always will). The following types work as views in this style:

    • functions that accept a single argument request, e.g.:

      def aview(request):
          pass
      
    • new and old-style classes that have an __init__ method that accepts self, request, e.g.:

      def View(object):
          __init__(self, request):
             pass
      
    • Arbitrary callables that have a __call__ method that accepts self, request, e.g.:

      def AView(object):
          def __call__(self, request):
             pass
      view = AView()
      

    This likely should have been the calling convention all along, as the request has context as an attribute already, and with views called as a result of URL dispatch, having the context in the arguments is not very useful. C'est la vie.

  • Cache the absolute path in the caller's package globals within repoze.bfg.path to get rid of repeated (expensive) calls to os.path.abspath.

  • Add reissue_time and timeout parameters to repoze.bfg.authentication.AuthTktAuthenticationPolicy constructor. If these are passed, cookies will be reset every so often (cadged from the same change to repoze.who lately).

  • The matchdict related to the matching of a Routes route is available on the request as the matchdict attribute: request.matchdict. If no route matched, this attribute will be None.

  • Make 404 responses slightly cheaper by showing environ["PATH_INFO"] on the notfound result page rather than the fullly computed URL.

  • Move LRU cache implementation into a separate package (repoze.lru).

  • The concepts of traversal and URL dispatch have been unified. It is now possible to use the same sort of factory as both a traversal "root factory" and what used to be referred to as a urldispatch "context factory".

  • When the root factory argument (as a first argument) passed to repoze.bfg.router.make_app is None, a default root factory is used. This is in support of using routes as "root finders"; it supplants the idea that there is a default IRoutesContextFactory.

  • The view` ZCML statement and the repoze.bfg.view.bfg_view decorator now accept an extra argument: route_name. If a route_name is specified, it must match the name of a previously defined route statement. When it is specified, the view will only be called when that route matches during a request.

  • It is now possible to perfom traversal after a route has matched. Use the pattern *traverse in a <route> path attribute within ZCML, and the path remainder which it matches will be used as a traversal path.

  • When any route defined matches, the WSGI environment will now contain a key bfg.routes.route (the Route object which matched), and a key bfg.routes.matchdict (the result of calling route.match).

廃止

  • Utility registrations against repoze.bfg.interfaces.INotFoundView and repoze.bfg.interfaces.IForbiddenView are now deprecated. Use the notfound and forbidden ZCML directives instead (see the "Hooks" chapter for more information). Such registrations will continue to work, but the notfound and forbidden directives do "extra work" to ensure that the callable named by the directive can be called by the router even if it's a class or request-argument-only view.

Removals

  • The IRoutesContext, IRoutesContextFactory, and IContextNotFound interfaces were removed from repoze.bfg.interfaces. These were never APIs.
  • The repoze.bfg.urldispatch.RoutesContextNotFound, repoze.bfg.urldispatch.RoutesModelTraverser and repoze.bfg.urldispatch.RoutesContextURL classes were removed. These were also never APIs.

後方の非互換性

  • Moved the repoze.bfg.push module, which implemented the pushpage decorator, into a separate distribution, repoze.bfg.pushpage. Applications which used this decorator should continue to work after adding that distribution to their installation requirements.
  • Changing the default request factory via an IRequestFactory utility registration (as used to be documented in the "Hooks" chapter's "Changing the request factory" section) is no longer supported. The dance to manufacture a request is complicated as a result of unifying traversal and url dispatch, making it highly unlikely for anyone to be able to override it properly. For those who just want to decorate or modify a request, use a NewRequestEvent subscriber (see the Events chapter in the documentation).
  • The repoze.bfg.IRequestFactory interface was removed. See the bullet above for why.
  • Routes "context factories" (spelled as the factory argument to a route statement in ZCML) must now expect the WSGI environ as a single argument rather than a set of keyword arguments. They can obtain the match dictionary by asking for environ['bfg.routes.matchdict']. This is the same set of keywords that used to be passed to urldispatch "context factories" in BFG 0.9 and below.
  • Using the @zope.component.adapter decorator on a bfg view function no longer works. Use the @repoze.bfg.view.bfg_view decorator instead to mark a function (or a class) as a view.
  • The name under which the matching route object is found in the environ was changed from bfg.route to bfg.routes.route.
  • Finding the root is now done before manufacturing a request object (and sending a new request event) within the router (it used to be performed afterwards).
  • Adding *path_info to a route no longer changes the PATH_INFO for a request that matches using URL dispatch. This feature was only there to service the repoze.bfg.wsgi.wsgiapp2 decorator and it did it wrong; use *subpath instead now.
  • The values of subpath, traversed, and virtual_root_path attached to the request object are always now tuples instead of lists (performance).

バグの修正

  • The bfg_alchemy Paster template named "repoze.tm" in its pipeline rather than "repoze.tm2", causing the startup to fail.
  • Move BBB logic for registering an IAuthenticationPolicy/IForbiddenView/INotFoundView based on older concepts from the router module's make_app function into the repoze.bfg.zcml.zcml_configure callable, to service compatibility with scripts that use "zope.configuration.xmlconfig" (replace with repoze.bfg.zml.zcml_configure as necessary to get BBB logic)

ドキュメンテーション

  • Add interface docs related to how to create authentication policies and authorization policies to the "Security" narrative chapter.
  • Added a (fairly sad) "Combining Traversal and URL Dispatch" chapter to the narrative documentation. This explains the usage of *traverse and *subpath in routes URL patters.
  • A "router" chapter explaining the request/response lifecycle at a high level was added.
  • Replaced all mentions and explanations of a routes "context factory" with equivalent explanations of a "root factory" (context factories have been disused).
  • Updated Routes bfgwiki2 tutorial to reflect the fact that context factories are now no longer used.

0.9.1 (2009-06-02)

特徴

  • Add API named repoze.bfg.settings.get_settings which retrieves a derivation of values passed as the options value of repoze.bfg.router.make_app. This API should be preferred instead of using getUtility(ISettings). I added a new repoze.bfg.settings API document as well.

バグの修正

  • Restored missing entry point declaration for bfg_alchemy paster template, which was accidentally removed in 0.9.

ドキュメンテーション

  • Fix a reference to wsgiapp in the wsgiapp2 API documentation within the repoze.bfg.wsgi module.

API Removals

  • The repoze.bfg.location.locate API was removed: it didn't do enough to be very helpful and had a misleading name.

0.9 (2009-06-01)

バグの修正

  • It was not possible to register a custom IRoutesContextFactory for use as a default context factory as documented in the "Hooks" chapter.

特徴

  • The request_type argument of ZCML view declarations and bfg_view decorators can now be one of the strings GET, POST, PUT, DELETE, or HEAD instead of a reference to the respective interface type imported from repoze.bfg.interfaces.
  • The route ZCML directive now accepts request_type as an alias for its condition_method argument for symmetry with the view directive.
  • The bfg_routesalchemy paster template now provides a unit test and actually uses the database during a view rendering.

Removals

  • Remove repoze.bfg.threadlocal.setManager. It was only used in unit tests.
  • Remove repoze.bfg.wsgi.HTTPException, repoze.bfg.wsgi.NotFound, and repoze.bfg.wsgi.Unauthorized. These classes were disused with the introduction of the IUnauthorizedView and INotFoundView machinery.

ドキュメンテーション

  • Add description to narrative templating chapter about how to use Chameleon text templates.
  • Changed Views narrative chapter to use method strings rather than interface types, and moved advanced interface type usage to Events narrative chapter.
  • Added a Routes+SQLAlchemy wiki tutorial.

0.9a8 (2009-05-31)

特徴

  • It is now possible to register a custom repoze.bfg.interfaces.INotFoundView for a given application. This feature replaces the repoze.bfg.interfaces.INotFoundAppFactory feature previously described in the Hooks chapter. The INotFoundView will be called when the framework detects that a view lookup done as a result of a request fails; it should accept a context object and a request object; it should return an IResponse object (a webob response, basically). See the Hooks narrative chapter of the BFG docs for more info.
  • The error presented when a view invoked by the router returns a non-response object now includes the view's name for troubleshooting purposes.

バグの修正

  • A "new response" event is emitted for forbidden and notfound views.

廃止

  • The repoze.bfg.interfaces.INotFoundAppFactory interface has been deprecated in favor of using the new repoze.bfg.interfaces.INotFoundView mechanism.

Renames

  • Renamed repoze.bfg.interfaces.IForbiddenResponseFactory to repoze.bfg.interfaces.IForbiddenView.

0.9a7 (2009-05-30)

特徴

  • Remove "context" argument from effective_principals and authenticated_userid function APIs in repoze.bfg.security, effectively a doing reversion to 0.8 and before behavior. Both functions now again accept only the request parameter.

0.9a6 (2009-05-29)

ドキュメンテーション

  • Changed "BFG Wiki" tutorial to use AuthTktAuthenticationPolicy rather than repoze.who.

特徴

  • Add an AuthTktAuthenticationPolicy. This policy retrieves credentials from an auth_tkt cookie managed by the application itself (instead of relying on an upstream data source for authentication data). See the Security API chapter of the documentation for more info.
  • Allow RemoteUserAuthenticationPolicy and RepozeWho1AuthenticationPolicy to accept various constructor arguments. See the Security API chapter of the documentation for more info.

0.9a5 (2009-05-28)

特徴

  • Add a get_app API functions to the paster module. This obtains a WSGI application from a config file given a config file name and a section name. See the repoze.bfg.paster API docs for more information.
  • Add a new module named scripting. It contains a get_root API function, which, provided a Router instance, returns a traversal root object and a "closer". See the repoze.bfg.scripting API docs for more info.

0.9a4 (2009-05-27)

バグの修正

  • Try checking for an "old style" security policy after we parse ZCML (thinko).

0.9a3 (2009-05-27)

特徴

  • Allow IAuthenticationPolicy and IAuthorizationPolicy to be overridden via ZCML registrations (do ZCML parsing after registering these in router.py).

ドキュメンテーション

  • Added "BFG Wiki" tutorial to documentation; it describes step-by-step how to create a traversal-based ZODB application with authentication.

廃止

  • Added deprecations for imports of ACLSecurityPolicy, InheritingACLSecurityPolicy, RemoteUserACLSecurityPolicy, RemoteUserInheritingACLSecurityPolicy, WhoACLSecurityPolicy, and WhoInheritingACLSecurityPolicy from the repoze.bfg.security module; for the meantime (for backwards compatibility purposes) these live in the repoze.bfg.secpols module. Note however, that the entire concept of a "security policy" is deprecated in BFG in favor of separate authentication and authorization policies, so any use of a security policy will generate additional deprecation warnings even if you do start using repoze.bfg.secpols. repoze.bfg.secpols will disappear in a future release of repoze.bfg.

Deprecated Import Alias Removals

  • Remove repoze.bfg.template module. All imports from this package have been deprecated since 0.3.8. Instead, import get_template, render_template, and render_template_to_response from the repoze.bfg.chameleon_zpt module.
  • Remove backwards compatibility import alias for repoze.bfg.traversal.split_path (deprecated since 0.6.5). This must now be imported as repoze.bfg.traversal.traversal_path).
  • Remove backwards compatibility import alias for repoze.bfg.urldispatch.RoutesContext (deprecated since 0.6.5). This must now be imported as repoze.bfg.urldispatch.DefaultRoutesContext.
  • Removed backwards compatibility import aliases for repoze.bfg.router.get_options and repoze.bfg.router.Settings (deprecated since 0.6.2). These both must now be imported from repoze.bfg.settings.
  • Removed backwards compatibility import alias for repoze.bfg.interfaces.IRootPolicy (deprecated since 0.6.2). It must be imported as repoze.bfg.interfaces.IRootFactory now.
  • Removed backwards compatibility import alias for repoze.bfg.interfaces.ITemplate (deprecated since 0.4.4). It must be imported as repoze.bfg.interfaces.ITemplateRenderer now.
  • Removed backwards compatibility import alias for repoze.bfg.interfaces.ITemplateFactory (deprecated since 0.4.4). It must be imported as repoze.bfg.interfaces.ITemplateRendererFactory now.
  • Removed backwards compatibility import alias for repoze.bfg.chameleon_zpt.ZPTTemplateFactory (deprecated since 0.4.4). This must be imported as repoze.bfg.ZPTTemplateRenderer now.

0.9a2 (2009-05-27)

特徴

  • A paster command has been added named "bfgshell". This command can be used to get an interactive prompt with your BFG root object in the global namespace. E.g.:

    bin/paster bfgshell /path/to/myapp.ini myapp
    

    See the Project chapter in the BFG documentation for more information.

廃止

  • The name repoze.bfg.registry.registry_manager was never an API, but scripts in the wild were using it to set up an environment for use under a debug shell. A backwards compatibility shim has been added for this purpose, but the feature is deprecated.

0.9a1 (2009-5-27)

特徴

  • New API functions named forget and remember are available in the security module. The forget function returns headers which will cause the currently authenticated user to be logged out when set in a response. The remember function (when passed the proper arguments) will return headers which will cause a principal to be "logged in" when set in a response. See the Security API chapter of the docs for more info.

  • New keyword arguments to the repoze.bfg.router.make_app call have been added: authentication_policy and authorization_policy. These should, respectively, be an implementation of an authentication policy (an object implementing the repoze.bfg.interfaces.IAuthenticationPolicy interface) and an implementation of an authorization policy (an object implementing repoze.bfg.interfaces.IAuthorizationPolicy). Concrete implementations of authentication policies exist in repoze.bfg.authentication. Concrete implementations of authorization policies exist in repoze.bfg.authorization.

    Both authentication_policy and authorization_policy default to None.

    If authentication_policy is None, but authorization_policy is not None, then authorization_policy is ignored (the ability to do authorization depends on authentication).

    If the authentication_policy argument is not None, and the authorization_policy argument is None, the authorization policy defaults to an authorization implementation that uses ACLs (repoze.bfg.authorization.ACLAuthorizationPolicy).

    We no longer encourage configuration of "security policies" using ZCML, as previously we did for ISecurityPolicy. This is because it's not uncommon to need to configure settings for concrete authorization or authentication policies using paste .ini parameters; the app entry point for your application is the natural place to do this.

  • Two new abstractions have been added in the way of adapters used by the system: an IAuthorizationPolicy and an IAuthenticationPolicy. A combination of these (as registered by the securitypolicy ZCML directive) take the place of the ISecurityPolicy abstraction in previous releases of repoze.who. The API functions in repoze.who.security (such as authentication_userid, effective_principals, has_permission, and so on) have been changed to try to make use of these new adapters. If you're using an older ISecurityPolicy adapter, the system will still work, but it will print deprecation warnings when such a policy is used.

  • The way the (internal) IViewPermission utilities registered via ZCML are invoked has changed. They are purely adapters now, returning a boolean result, rather than returning a callable. You shouldn't have been using these anyway. ;-)

  • New concrete implementations of IAuthenticationPolicy have been added to the repoze.bfg.authentication module: RepozeWho1AuthenticationPolicy which uses repoze.who identity to retrieve authentication data from and RemoteUserAuthenticationPolicy, which uses the REMOTE_USER value in the WSGI environment to retrieve authentication data.

  • A new concrete implementation of IAuthorizationPolicy has been added to the repoze.bfg.authorization module: ACLAuthorizationPolicy which uses ACL inheritance to do authorization.

  • It is now possible to register a custom repoze.bfg.interfaces.IForbiddenResponseFactory for a given application. This feature replaces the repoze.bfg.interfaces.IUnauthorizedAppFactory feature previously described in the Hooks chapter. The IForbiddenResponseFactory will be called when the framework detects an authorization failure; it should accept a context object and a request object; it should return an IResponse object (a webob response, basically). Read the below point for more info and see the Hooks narrative chapter of the BFG docs for more info.

後方の非互換性

  • Custom NotFound and Forbidden (nee' Unauthorized) WSGI applications (registered as a utility for INotFoundAppFactory and IUnauthorizedAppFactory) could rely on an environment key named message describing the circumstance of the response. This key has been renamed to repoze.bfg.message (as per the WSGI spec, which requires environment extensions to contain dots).

廃止

  • The repoze.bfg.interfaces.IUnauthorizedAppFactory interface has been deprecated in favor of using the new repoze.bfg.interfaces.IForbiddenResponseFactory mechanism.
  • The view_execution_permitted API should now be imported from the repoze.bfg.security module instead of the repoze.bfg.view module.
  • The authenticated_userid and effective_principals APIs in repoze.bfg.security used to only take a single argument (request). They now accept two arguments (context and request). Calling them with a single argument is still supported but issues a deprecation warning. (NOTE: this change was reverted in 0.9a7; meaning the 0.9 versions of these functions again accept request only, just like 0.8 and before).
  • Use of "old-style" security policies (those base on ISecurityPolicy) is now deprecated. See the "Security" chapter of the docs for info about activating an authorization policy and an authentication poicy.

0.8.1 (2009-05-21)

特徴

  • Class objects may now be used as view callables (both via ZCML and via use of the bfg_view decorator in Python 2.6 as a class decorator). The calling semantics when using a class as a view callable is similar to that of using a class as a Zope "browser view": the class' __init__ must accept two positional parameters (conventionally named context, and request). The resulting instance must be callable (it must have a __call__ method). When called, the instance should return a response. For example:

     from webob import Response
    
     class MyView(object):
         def __init__(self, context, request):
             self.context = context
             self.request = request
    
         def __call__(self):
             return Response('hello from %s!' % self.context)
    
    See the "Views" chapter in the documentation and the
    ``repoze.bfg.view`` API documentation for more information.
    
  • Removed the pickling of ZCML actions (the code that wrote configure.zcml.cache next to configure.zcml files in projects). The code which managed writing and reading of the cache file was a source of subtle bugs when users switched between imperative (e.g. @bfg_view) registrations and declarative registrations (e.g. the view directive in ZCML) on the same project. On a moderately-sized project (535 ZCML actions and 15 ZCML files), executing actions read from the pickle was saving us only about 200ms (2.5 sec vs 2.7 sec average). On very small projects (1 ZCML file and 4 actions), startup time was comparable, and sometimes even slower when reading from the pickle, and both ways were so fast that it really just didn't matter anyway.

0.8 (2009-05-18)

特徴

  • Added a traverse function to the repoze.bfg.traversal module. This function may be used to retrieve certain values computed during path resolution. See the Traversal API chapter of the documentation for more information about this function.

廃止

  • Internal: ITraverser callables should now return a dictionary rather than a tuple. Up until 0.7.0, all ITraversers were assumed to return a 3-tuple. In 0.7.1, ITraversers were assumed to return a 6-tuple. As (by evidence) it's likely we'll need to add further information to the return value of an ITraverser callable, 0.8 assumes that an ITraverser return a dictionary with certain elements in it. See the repoze.bfg.interfaces.ITraverser interface for the list of keys that should be present in the dictionary. ITraversers which return tuples will still work, although a deprecation warning will be issued.

後方の非互換性

  • If your code used the ITraverser interface directly (not via an API function such as find_model) via an adapter lookup, you'll need to change your code to expect a dictionary rather than a 3- or 6-tuple if your code ever gets return values from the default ModelGraphTraverser or RoutesModelTraverser adapters.

0.8a7 (2009-05-16)

後方の非互換性

  • The RoutesMapper class in repoze.bfg.urldispatch has been removed, as well as its documentation. It had been deprecated since 0.6.3. Code in repoze.bfg.urldispatch.RoutesModelTraverser which catered to it has also been removed.

  • The semantics of the route ZCML directive have been simplified. Previously, it was assumed that to use a route, you wanted to map a route to an externally registered view. The new route directive instead has a view attribute which is required, specifying the dotted path to a view callable. When a route directive is processed, a view is registered using the name attribute of the route directive as its name and the callable as its value. The view_name and provides attributes of the route directive are therefore no longer used. Effectively, if you were previously using the route directive, it means you must change a pair of ZCML directives that look like this:

    <route
       name="home"
       path=""
       view_name="login"
       factory=".models.root.Root"
     />
    
    <view
       for=".models.root.Root"
       name="login"
       view=".views.login_view"
     />
    

    To a ZCML directive that looks like this:

    <route
       name="home"
       path=""
       view=".views.login_view"
       factory=".models.root.Root"
     />
    

    In other words, to make old code work, remove the view directives that were only there to serve the purpose of backing route directives, and move their view= attribute into the route directive itself.

    This change also necessitated that the name attribute of the route directive is now required. If you were previously using route directives without a name attribute, you'll need to add one (the name is arbitrary, but must be unique among all route and view statements).

    The provides attribute of the route directive has also been removed. This directive specified a sequence of interface types that the generated context would be decorated with. Since route views are always generated now for a single interface (repoze.bfg.IRoutesContext) as opposed to being looked up arbitrarily, there is no need to decorate any context to ensure a view is found.

ドキュメンテーション

  • Added API docs for the repoze.bfg.testing methods registerAdapter, registerUtiity, registerSubscriber, and cleanUp.
  • Added glossary entry for "root factory".
  • Noted existence of repoze.bfg.pagetemplate template bindings in "Available Add On Template System Bindings" in Templates chapter in narrative docs.
  • Update "Templates" narrative chapter in docs (expand to show a sample template and correct macro example).

特徴

  • Courtesty Carlos de la Guardia, added an alchemy Paster template. This paster template sets up a BFG project that uses SQAlchemy (with SQLite) and uses traversal to resolve URLs. (no Routes areused). This template can be used via paster create -t bfg_alchemy.
  • The Routes Route object used to resolve the match is now put into the environment as bfg.route when URL dispatch is used.
  • You can now change the default Routes "context factory" globally. See the "ZCML Hooks" chapter of the documentation (in the "Changing the Default Routes Context Factory" section).

0.8a6 (2009-05-11)

特徴

  • Added a routesalchemy Paster template. This paster template sets up a BFG project that uses SQAlchemy (with SQLite) and uses Routes exclusively to resolve URLs (no traversal root factory is used). This template can be used via paster create -t bfg_routesalchemy.

ドキュメンテーション

  • Added documentation to the URL Dispatch chapter about how to catch the root URL using a ZCML route directive.
  • Added documentation to the URL Dispatch chapter about how to perform a cleanup function at the end of a request (e.g. close the SQL connection).

バグの修正

  • In version 0.6.3, passing a get_root callback (a "root factory") to repoze.bfg.router.make_app became optional if any route declaration was made in ZCML. The intent was to make it possible to disuse traversal entirely, instead relying entirely on URL dispatch (Routes) to resolve all contexts. However a compound set of bugs prevented usage of a Routes-based root view (a view which responds to "/"). One bug existed in repoze.bfg.urldispatch`, another existed in Routes itself.

    To resolve this issue, the urldispatch module was fixed, and a fork of the Routes trunk was put into the "dev" index named Routes-1.11dev-chrism-home. The source for the fork exists at http://bitbucket.org/chrism/routes-home/ (broken link); its contents have been merged into the Routes trunk (what will be Routes 1.11).

0.8a5 (2009-05-08)

特徴

  • Two new security policies were added: RemoteUserInheritingACLSecurityPolicy and WhoInheritingACLSecurityPolicy. These are security policies which take into account all ACLs defined in the lineage of a context rather than stopping at the first ACL found in a lineage. See the "Security" chapter of the API documentation for more information.
  • The API and narrative documentation dealing with security was changed to introduce the new "inheriting" security policy variants.
  • Added glossary entry for "lineage".

廃止

  • The security policy previously named RepozeWhoIdentityACLSecurityPolicy now has the slightly saner name of WhoACLSecurityPolicy. A deprecation warning is emitted when this policy is imported under the "old" name; usually this is due to its use in ZCML within your application. If you're getting this deprecation warning, change your ZCML to use the new name, e.g. change:

    <utility
      provides="repoze.bfg.interfaces.ISecurityPolicy"
      factory="repoze.bfg.security.RepozeWhoIdentityACLSecurityPolicy"
      />
    

    To:

    <utility
      provides="repoze.bfg.interfaces.ISecurityPolicy"
      factory="repoze.bfg.security.WhoACLSecurityPolicy"
      />
    

0.8a4 (2009-05-04)

特徴

  • zope.testing is no longer a direct dependency, although our dependencies (such as zope.interface, repoze.zcml, etc) still depend on it.
  • Tested on Google App Engine. Added a tutorial to the documentation explaining how to deploy a BFG app to GAE.

後方の非互換性

  • Applications which rely on zope.testing.cleanup.cleanUp in unit tests can still use that function indefinitely. However, for maximum forward compatibility, they should import cleanUp from repoze.bfg.testing instead of from zope.testing.cleanup. The BFG paster templates and docs have been changed to use this function instead of the zope.testing.cleanup version.

0.8a3 (2009-05-03)

特徴

  • Don't require a successful import of zope.testing at BFG application runtime. This allows us to get rid of zope.testing on platforms like GAE which have file limits.

0.8a2 (2009-05-02)

特徴

  • We no longer include the configure.zcml of the chameleon.zpt package within the configure.zcml of the "repoze.bfg.includes" package. This has been a no-op for some time now.
  • The repoze.bfg.chameleon_zpt package no longer imports from chameleon.zpt at module scope, deferring the import until later within a method call. The chameleon.zpt package can't be imported on platforms like GAE.

0.8a1 (2009-05-02)

Deprecation Warning and Import Alias Removals

  • Since version 0.6.1, a deprecation warning has been emitted when the name model_url is imported from the repoze.bfg.traversal module. This import alias (and the deprecation warning) has been removed. Any import of the model_url function will now need to be done from repoze.bfg.url; any import of the name model_url from repoze.bfg.traversal will now fail. This was done to remove a dependency on zope.deferredimport.
  • Since version 0.6.5, a deprecation warning has been emitted when the name RoutesModelTraverser is imported from the repoze.bfg.traversal module. This import alias (and the deprecation warning) has been removed. Any import of the RoutesModelTraverser class will now need to be done from repoze.bfg.urldispatch; any import of the name RoutesModelTraverser from repoze.bfg.traversal will now fail. This was done to remove a dependency on zope.deferredimport.

特徴

  • This release of repoze.bfg is "C-free". This means it has no hard dependencies on any software that must be compiled from C source at installation time. In particular, repoze.bfg no longer depends on the lxml package.

    This change has introduced some backwards incompatibilities, described in the "Backwards Incompatibilities" section below.

  • This release was tested on Windows XP. It appears to work fine and all the tests pass.

後方の非互換性

Incompatibilities related to making repoze.bfg "C-free":

  • Removed the repoze.bfg.chameleon_genshi module, and thus support for Genshi-style chameleon templates. Genshi-style Chameleon templates depend upon lxml, which is implemented in C (as opposed to pure Python) and the repoze.bfg core is "C-free" as of this release. You may get Genshi-style Chameleon support back by installing the repoze.bfg.chameleon_genshi package availalable from http://svn.repoze.org/repoze.bfg.chameleon_genshi (also available in the index at http://dist.repoze.org/bfg/0.8/simple). All existing code that depended on the chameleon_genshi module prior to this release of repoze.bfg should work without change after this addon is installed.
  • Removed the repoze.bfg.xslt module and thus support for XSL templates. The repoze.bfg.xslt module depended upon lxml, which is implemented in C, and the repoze.bfg core is "C-free" as of this release. You bay get XSL templating back by installing the repoze.bfg.xslt package available from http://svn.repoze.org/repoze.bfg.xslt/ (also available in the index at http://dist.repoze.org/bfg/0.8/simple). All existing code that depended upon the xslt module prior to this release of repoze.bfg should work without modification after this addon is installed.
  • Removed the repoze.bfg.interfaces.INodeTemplateRenderer interface and the an old b/w compat aliases from that interface to repoze.bfg.interfaces.INodeTemplate. This interface must now be imported from the repoze.bfg.xslt.interfaces package after installation of the repoze.bfg.xslt addon package described above as repoze.bfg.interfaces.INodeTemplateRenderer. This interface was never part of any public API.

Other backwards incompatibilities:

  • The render_template function in repoze.bfg.chameleon_zpt returns Unicode instead of a string. Likewise, the individual values returned by the iterable created by the render_template_to_iterable function are also each Unicode. This is actually a backwards incompatibility inherited from our new use of the combination of chameleon.core 1.0b32 (the non-lxml-depending version) and chameleon.zpt 1.0b16+ ; the chameleon.zpt PageTemplateFile implementation used to return a string, but now returns Unicode.

0.7.1 (2009-05-01)

特徴

  • The "paster create" templates have been modified to use links to the new "bfg.repoze.org" and "docs.repoze.org" websites.

  • Added better documentation for virtual hosting at a URL prefix within the virtual hosting docs chapter.

  • The interface for repoze.bfg.interfaces.ITraverser and the built-in implementations that implement the interface (repoze.bfg.traversal.ModelGraphTraverser, and repoze.bfg.urldispatch.RoutesModelTraverser) now expect the __call__ method of an ITraverser to return 3 additional arguments: traversed, virtual_root, and virtual_root_path (the old contract was that the __call__ method of an ITraverser returned; three arguments, the contract new is that it returns six). traversed will be a sequence of Unicode names that were traversed (including the virtual root path, if any) or None if no traversal was performed, virtual_root will be a model object representing the virtual root (or the physical root if traversal was not performed), and virtual_root_path will be a sequence representing the virtual root path (a sequence of Unicode names) or None if traversal was not performed.

    Six arguments are now returned from BFG ITraversers. They are returned in this order: context, view_name, subpath, traversed, virtual_root, and virtual_root_path.

    Places in the BFG code which called an ITraverser continue to accept a 3-argument return value, although BFG will generate and log a warning when one is encountered.

  • The request object now has the following attributes: traversed (the sequence of names traversed or None if traversal was not performed), virtual_root (the model object representing the virtual root, including the virtual root path if any), and virtual_root_path (the seuquence of names representing the virtual root path or None if traversal was not performed).

  • A new decorator named wsgiapp2 was added to the repoze.bfg.wsgi module. This decorator performs the same function as repoze.bfg.wsgi.wsgiapp except it fixes up the SCRIPT_NAME, and PATH_INFO environment values before invoking the WSGI subapplication.

  • The repoze.bfg.testing.DummyRequest object now has default attributes for traversed, virtual_root, and virtual_root_path.

  • The RoutesModelTraverser now behaves more like the Routes "RoutesMiddleware" object when an element in the match dict is named path_info (usually when there's a pattern like http://foo/*path_info). When this is the case, the PATH_INFO environment variable is set to the value in the match dict, and the SCRIPT_NAME is appended to with the prefix of the original PATH_INFO not including the value of the new variable.

  • The notfound debug now shows the traversed path, the virtual root, and the virtual root path too.

  • Speed up / clarify 'traversal' module's 'model_path', 'model_path_tuple', and '_model_path_list' functions.

後方の非互換性

  • In previous releases, the repoze.bfg.url.model_url, repoze.bfg.traversal.model_path and repoze.bfg.traversal.model_path_tuple functions always ignored the __name__ argument of the root object in a model graph ( effectively replacing it with a leading / in the returned value) when a path or URL was generated. The code required to perform this operation was not efficient. As of this release, the root object in a model graph must have a __name__ attribute that is either None or the empty string ('') for URLs and paths to be generated properly from these APIs. If your root model object has a __name__ argument that is not one of these values, you will need to change your code for URLs and paths to be generated properly. If your model graph has a root node with a string __name__ that is not null, the value of __name__ will be prepended to every path and URL generated.

  • The repoze.bfg.location.LocationProxy class and the repoze.bfg.location.ClassAndInstanceDescr class have both been removed in order to be able to eventually shed a dependency on zope.proxy. Neither of these classes was ever an API.

  • In all previous releases, the repoze.bfg.location.locate function worked like so: if a model did not explicitly provide the repoze.bfg.interfaces.ILocation interface, locate returned a LocationProxy object representing model with its __parent__ attribute assigned to parent and a __name__ attribute assigned to __name__. In this release, the repoze.bfg.location.locate function simply jams the __name__ and __parent__ attributes on to the supplied model unconditionally, no matter if the object implements ILocation or not, and it never returns a proxy. This was done because the LocationProxy behavior has now moved into an add-on package (repoze.bfg.traversalwrapper), in order to eventually be able to shed a dependency on zope.proxy.

  • In all previous releases, by default, if traversal was used (as opposed to URL-dispatch), and the root object supplied the``repoze.bfg.interfaces.ILocation`` interface, but the children returned via its __getitem__ returned an object that did not implement the same interface, repoze.bfg provided some implicit help during traversal. This traversal feature wrapped subobjects from the root (and thereafter) that did not implement ILocation in proxies which automatically provided them with a __name__ and __parent__ attribute based on the name being traversed and the previous object traversed. This feature has now been removed from the base repoze.bfg package for purposes of eventually shedding a dependency on zope.proxy.

    In order to re-enable the wrapper behavior for older applications which cannot be changed, register the "traversalwrapper" ModelGraphTraverser as the traversal policy, rather than the default ModelGraphTraverser. To use this feature, you will need to install the repoze.bfg.traversalwrapper package (an add-on package, available at http://svn.repoze.org/repoze.bfg.traversalwrapper) Then change your application's configure.zcml to include the following stanza:

    <adapter

    factory="repoze.bfg.traversalwrapper.ModelGraphTraverser" provides="repoze.bfg.interfaces.ITraverserFactory" for="*" />

    When this ITraverserFactory is used instead of the default, no object in the graph (even the root object) must supply a __name__ or __parent__ attribute. Even if subobjects returned from the root do implement the ILocation interface, these will still be wrapped in proxies that override the object's "real" __parent__ and __name__ attributes.

    See also changes to the "Models" chapter of the documentation (in the "Location-Aware Model Instances") section.

0.7.0 (2009-04-11)

バグの修正

  • Fix a bug in repoze.bfg.wsgi.HTTPException: the content length was returned as an int rather than as a string.
  • Add explicit dependencies on zope.deferredimport, zope.deprecation, and zope.proxy for forward compatibility reasons (zope.component will stop relying on zope.deferredimport soon and although we use it directly, it's only a transitive dependency, and ''zope.deprecation`` and zope.proxy are used directly even though they're only transitive dependencies as well).
  • Using model_url or model_path against a broken model graph (one with models that had a non-root model with a __name__ of None) caused an inscrutable error to be thrown: ( if not _must_quote[cachekey].search(s): TypeError: expected string or buffer). Now URLs and paths generated against graphs that have None names in intermediate nodes will replace the None with the empty string, and, as a result, the error won't be raised. Of course the URL or path will still be bogus.

特徴

  • Make it possible to have testing.DummyTemplateRenderer return some nondefault string representation.
  • Added a new anchor keyword argument to model_url. If anchor is present, its string representation will be used as a named anchor in the generated URL (e.g. if anchor is passed as foo and the model URL is http://example.com/model/url, the generated URL will be http://example.com/model/url#foo).

後方の非互換性

  • The default request charset encoding is now utf-8. As a result, the request machinery will attempt to decode values from the utf-8 encoding to Unicode automatically when they are obtained via request.params, request.GET, and request.POST. The previous behavior of BFG was to return a bytestring when a value was accessed in this manner. This change will break form handling code in apps that rely on values from those APIs being considered bytestrings. If you are manually decoding values from form submissions in your application, you'll either need to change the code that does that to expect Unicode values from request.params, request.GET and request.POST, or you'll need to explicitly reenable the previous behavior. To reenable the previous behavior, add the following to your application's configure.zcml:

    <subscriber for="repoze.bfg.interfaces.INewRequest"
                handler="repoze.bfg.request.make_request_ascii"/>
    

    See also the documentation in the "Views" chapter of the BFG docs entitled "Using Views to Handle Form Submissions (Unicode and Character Set Issues)".

ドキュメンテーション

  • Add a section to the narrative Views chapter entitled "Using Views to Handle Form Submissions (Unicode and Character Set Issues)" explaining implicit decoding of form data values.

0.6.9 (2009-02-16)

バグの修正

  • lru cache was unstable under concurrency (big surprise!) when it tried to redelete a key in the cache that had already been deleted. Symptom: line 64 in put:del data[oldkey]:KeyError: '/some/path'. Now we just ignore the key error if we can't delete the key (it has already been deleted).
  • Empty location names in model paths when generating a URL using repoze.bfg.model_url based on a model obtained via traversal are no longer ignored in the generated URL. This means that if a non-root model object has a __name__ of '', the URL will reflect it (e.g. model_url will generate http://foo/bar//baz if an object with the __name__ of '' is a child of bar and the parent of baz). URLs generated with empty path segments are, however, still irresolveable by the model graph traverser on request ingress (the traverser strips empty path segment names).

特徴

  • Microspeedups of repoze.bfg.traversal.model_path, repoze.bfg.traversal.model_path_tuple, repoze.bfg.traversal.quote_path_segment, and repoze.bfg.url.urlencode.
  • add zip_safe = false to setup.cfg.

ドキュメンテーション

  • Add a note to the repoze.bfg.traversal.quote_path_segment API docs about caching of computed values.

Implementation Changes

  • Simplification of repoze.bfg.traversal.TraversalContextURL.__call__ (it now uses repoze.bfg.traversal.model_path instead of rolling its own path-generation).

0.6.8 (2009-02-05)

後方の非互換性

  • The repoze.bfg.traversal.model_path API now returns a quoted string rather than a string represented by series of unquoted elements joined via / characters. Previously it returned a string or unicode object representing the model path, with each segment name in the path joined together via / characters, e.g. /foo /bar. Now it returns a string, where each segment is a UTF-8 encoded and URL-quoted element e.g. /foo%20/bar. This change was (as discussed briefly on the repoze-dev maillist) necessary to accomodate model objects which themselves have __name__ attributes that contain the / character.

    For people that have no models that have high-order Unicode __name__ attributes or __name__ attributes with values that require URL-quoting with in their model graphs, this won't cause any issue. However, if you have code that currently expects model_path to return an unquoted string, or you have an existing application with data generated via the old method, and you're too lazy to change anything, you may wish replace the BFG-imported model_path in your code with this function (this is the code of the "old" model_path implementation):

    from repoze.bfg.location import lineage
    
    def i_am_too_lazy_to_move_to_the_new_model_path(model, *elements):
        rpath = []
        for location in lineage(model):
            if location.__name__:
                rpath.append(location.__name__)
        path = '/' + '/'.join(reversed(rpath))
        if elements:
            suffix = '/'.join(elements)
            path = '/'.join([path, suffix])
        return path
    
  • The repoze.bfg.traversal.find_model API no longer implicitly converts unicode representations of a full path passed to it as a Unicode object into a UTF-8 string. Callers should either use prequoted path strings returned by repoze.bfg.traversal.model_path, or tuple values returned by the result of repoze.bfg.traversal.model_path_tuple or they should use the guidelines about passing a string path argument described in the find_model API documentation.

Bugfixes

  • Each argument contained in elements passed to repoze.bfg.traversal.model_path will now have any / characters contained within quoted to %2F in the returned string. Previously, / characters in elements were left unquoted (a bug).

特徴

  • A repoze.bfg.traversal.model_path_tuple API was added. This API is an alternative to model_path (which returns a string); model_path_tuple returns a model path as a tuple (much like Zope's getPhysicalPath).
  • A repoze.bfg.traversal.quote_path_segment API was added. This API will quote an individual path segment (string or unicode object). See the repoze.bfg.traversal API documentation for more information.
  • The repoze.bfg.traversal.find_model API now accepts "path tuples" (see the above note regarding model_path_tuple) as well as string path representations (from repoze.bfg.traversal.model_path) as a path argument.
  • Add ` renderer` argument (defaulting to None) to repoze.bfg.testing.registerDummyRenderer. This makes it possible, for instance, to register a custom renderer that raises an exception in a unit test.

Implementation Changes

  • Moved _url_quote function back to repoze.bfg.traversal from repoze.bfg.url. This is not an API.

0.6.7 (2009-01-27)

特徴

  • The repoze.bfg.url.model_url API now works against contexts derived from Routes URL dispatch (Routes.util.url_for is called under the hood).
  • "Virtual root" support for traversal-based applications has been added. Virtual root support is useful when you'd like to host some model in a repoze.bfg model graph as an application under a URL pathname that does not include the model path itself. For more information, see the (new) "Virtual Hosting" chapter in the documentation.
  • A repoze.bfg.traversal.virtual_root API has been added. When called, it returns the virtual root object (or the physical root object if no virtual root has been specified).

Implementation Changes

  • repoze.bfg.traversal.RoutesModelTraverser has been moved to repoze.bfg.urldispatch.
  • model_url URL generation is now performed via an adapter lookup based on the context and the request.
  • ZCML which registers two adapters for the IContextURL interface has been added to the configure.zcml in repoze.bfg.includes.

0.6.6 (2009-01-26)

Implementation Changes

  • There is an indirection in repoze.bfg.url.model_url now that consults a utility to generate the base model url (without extra elements or a query string). Eventually this will service virtual hosting; for now it's undocumented and should not be hooked.

0.6.5 (2009-01-26)

特徴

  • You can now override the NotFound and Unauthorized responses that repoze.bfg generates when a view cannot be found or cannot be invoked due to lack of permission. See the "ZCML Hooks" chapter in the docs for more information.
  • Added Routes ZCML directive attribute explanations in documentation.
  • Added a traversal_path API to the traversal module; see the "traversal" API chapter in the docs. This was a function previously known as split_path that was not an API but people were using it anyway. Unlike split_path, it now returns a tuple instead of a list (as its values are cached).

行動の変化

  • The repoze.bfg.view.render_view_to_response API will no longer raise a ValueError if an object returned by a view function it calls does not possess certain attributes (headerlist, app_iter, status). This API used to attempt to perform a check using the is_response function in repoze.bfg.view, and raised a ValueError if the is_response check failed. The responsibility is now the caller's to ensure that the return value from a view function is a "real" response.
  • WSGI environ dicts passed to repoze.bfg 's Router must now contain a REQUEST_METHOD key/value; if they do not, a KeyError will be raised (speed).
  • It is no longer permissible to pass a "nested" list of principals to repoze.bfg.ACLAuthorizer.permits (e.g. ['fred', ['larry', 'bob']]). The principals list must be fully expanded. This feature was never documented, and was never an API, so it's not a backwards incompatibility.
  • It is no longer permissible for a security ACE to contain a "nested" list of permissions (e.g. (Allow, Everyone, ['read', ['view', ['write', 'manage']]])`)`.  The list must instead be fully expanded (e.g. ``(Allow, Everyone, ['read', 'view', 'write', 'manage])). This feature was never documented, and was never an API, so it's not a backwards incompatibility.
  • The repoze.bfg.urldispatch.RoutesRootFactory now injects the wsgiorg.routing_args environment variable into the environ when a route matches. This is a tuple of ((), routing_args) where routing_args is the value that comes back from the routes mapper match (the "match dict").
  • The repoze.bfg.traversal.RoutesModelTraverser class now wants to obtain the view_name and subpath from the wsgiorgs.routing_args environment variable. It falls back to obtaining these from the context for backwards compatibility.

Implementation Changes

  • Get rid of repoze.bfg.security.ACLAuthorizer: the ACLSecurityPolicy now does what it did inline.
  • Get rid of repoze.bfg.interfaces.NoAuthorizationInformation exception: it was used only by ACLAuthorizer.
  • Use a homegrown NotFound error instead of webob.exc.HTTPNotFound (the latter is slow).
  • Use a homegrown Unauthorized error instead of webob.exc.Unauthorized (the latter is slow).
  • the repoze.bfg.lru.lru_cached decorator now uses functools.wraps in order to make documentation of LRU-cached functions possible.
  • Various speed micro-tweaks.

バグの修正

  • repoze.bfg.testing.DummyModel did not have a get method; it now does.

0.6.4 (2009-01-23)

後方の非互換性

  • The unicode_path_segments configuration variable and the BFG_UNICODE_PATH_SEGMENTS configuration variable have been removed. Path segments are now always passed to model __getitem__ methods as unicode. "True" has been the default for this setting since 0.5.4, but changing this configuration setting to false allowed you to go back to passing raw path element strings to model __getitem__ methods. Removal of this knob services a speed goal (we get about +80 req/s by removing the check), and it's clearer just to always expect unicode path segments in model __getitem__ methods.

Implementation Changes

  • repoze.bfg.traversal.split_path now also handles decoding path segments to unicode (for speed, because its results are cached).
  • repoze.bfg.traversal.step was made a method of the
    ModelGraphTraverser.
  • Use "precooked" Request subclasses (e.g. repoze.bfg.request.GETRequest) that correspond to HTTP request methods within router.py when constructing a request object rather than using alsoProvides to attach the proper interface to an unsubclassed webob.Request. This pattern is purely an optimization (e.g. preventing calls to alsoProvides means the difference between 590 r/s and 690 r/s on a MacBook 2GHz).
  • Tease out an extra 4% performance boost by changing the Router; instead of using imported ZCA APIs, use the same APIs directly against the registry that is an attribute of the Router.
  • The registry used by BFG is now a subclass of zope.component.registry.Components (defined as repoze.bfg.registry.Registry); it has a notify method, a registerSubscriptionAdapter and a registerHandler method. If no subscribers are registered via registerHandler or registerSubscriptionAdapter, notify is a noop for speed.
  • The Allowed and Denied classes in repoze.bfg.security now are lazier about constructing the representation of a reason message for speed; repoze.bfg.view_execution_permitted takes advantage of this.
  • The is_response check was sped up by about half at the expense of making its code slightly uglier.

New Modules

  • repoze.bfg.lru implements an LRU cache class and a decorator for internal use.

0.6.3 (2009-01-19)

バグの修正

  • Readd root_policy attribute on Router object (as a property which returns the IRootFactory utility). It was inadvertently removed in 0.6.2. Code in the wild depended upon its presence (esp. scripts and "debug" helpers).

特徴

  • URL-dispatch has been overhauled: it is no longer necessary to manually create a RoutesMapper in your application's entry point callable in order to use URL-dispatch (aka Routes). A new route directive has been added to the available list of ZCML directives. Each route directive inserted into your application's configure.zcml establishes a Routes mapper connection. If any route declarations are made via ZCML within a particular application, the get_root callable passed in to repoze.bfg.router.make_app will automatically be wrapped in the equivalent of a RoutesMapper. Additionally, the new route directive allows the specification of a context_interfaces attribute for a route, this will be used to tag the manufactured routes context with specific interfaces when a route specifying a context_interfaces attribute is matched.
  • A new interface repoze.bfg.interfaces.IContextNotFound was added. This interface is attached to a "dummy" context generated when Routes cannot find a match and there is no "fallback" get_root callable that uses traversal.
  • The bfg_starter and bfg_zodb "paster create" templates now contain images and CSS which are displayed when the default page is displayed after initial project generation.
  • Allow the repoze.bfg.view.static helper to be passed a relative root_path name; it will be considered relative to the file in which it was called.
  • The functionality of repoze.bfg.convention has been merged into the core. Applications which make use of repoze.bfg.convention will continue to work indefinitely, but it is recommended that apps stop depending upon it. To do so, substitute imports of repoze.bfg.convention.bfg_view with imports of repoze.bfg.view.bfg_view, and change the stanza in ZCML from <convention package="."> to <scan package=".">. As a result of the merge, bfg has grown a new dependency: martian.
  • View functions which use the pushpage decorator are now pickleable (meaning their use won't prevent a configure.zcml.cache file from being written to disk).
  • Instead of invariably using webob.Request as the "request factory" (e.g. in the Router class) and webob.Response and the "response factory" (e.g. in render_template_to_response), allow both to be overridden via a ZCML utility hook. See the "Using ZCML Hooks" chapter of the documentation for more information.

廃止

  • The class repoze.bfg.urldispatch.RoutesContext has been renamed to repoze.bfg.urldispatch.DefaultRoutesContext. The class should be imported by the new name as necessary (although in reality it probably shouldn't be imported from anywhere except internally within BFG, as it's not part of the API).

Implementation Changes

  • The repoze.bfg.wsgi.wsgiapp decorator now uses webob.Request.get_response to do its work rather than relying on homegrown WSGI code.
  • The repoze.bfg.view.static helper now uses webob.Request.get_response to do its work rather than relying on homegrown WSGI code.
  • The repoze.bfg.urldispatch.RoutesModelTraverser class has been moved to repoze.bfg.traversal.RoutesModelTraverser.
  • The repoze.bfg.registry.makeRegistry function was renamed to repoze.bfg.registry.populateRegistry and now accepts a registry argument (which should be an instance of zope.component.registry.Components).

Documentation Additions

  • Updated narrative urldispatch chapter with changes required by <route..> ZCML directive.
  • Add a section on "Using BFG Security With URL Dispatch" into the urldispatch chapter of the documentation.
  • Better documentation of security policy implementations that ship with repoze.bfg.
  • Added a "Using ZPT Macros in repoze.bfg" section to the narrative templating chapter.

0.6.2 (2009-01-13)

特徴

  • Tests can be run with coverage output if you've got nose installed in the interpreter which you use to run tests. Using an interpreter with nose installed, do python setup.py nosetests within a checkout of the repoze.bfg package to see test coverage output.
  • Added a post argument to the repoze.bfg.testing:DummyRequest constructor.
  • Added __len__ and __nonzero__ to repoze.bfg.testing:DummyModel.
  • The repoze.bfg.registry.get_options callable (now renamed to repoze.bfg.setings.get_options) used to return only framework-specific keys and values in the dictionary it returned. It now returns all the keys and values in the dictionary it is passed plus any framework-specific settings culled from the environment. As a side effect, all PasteDeploy application-specific config file settings are made available as attributes of the ISettings utility from within BFG.
  • Renamed the existing BFG paster template to bfg_starter. Added another template (bfg_zodb) showing default ZODB setup using repoze.zodbconn.
  • Add a method named assert_ to the DummyTemplateRenderer. This method accepts keyword arguments. Each key/value pair in the keyword arguments causes an assertion to be made that the renderer received this key with a value equal to the asserted value.
  • Projects generated by the paster templates now use the DummyTemplateRenderer.assert_ method in their view tests.
  • Make the (internal) thread local registry manager maintain a stack of registries in order to make it possible to call one BFG application from inside another.
  • An interface specific to the HTTP verb (GET/PUT/POST/DELETE/HEAD) is attached to each request object on ingress. The HTTP-verb-related interfaces are defined in repoze.bfg.interfaces and are IGETRequest, IPOSTRequest, IPUTRequest, IDELETERequest and IHEADRequest. These interfaces can be specified as the request_type attribute of a bfg view declaration. A view naming a specific HTTP-verb-matching interface will be found only if the view is defined with a request_type that matches the HTTP verb in the incoming request. The more general IRequest interface can be used as the request_type to catch all requests (and this is indeed the default). All requests implement IRequest. The HTTP-verb-matching idea was pioneered by repoze.bfg.restrequest . That package is no longer required, but still functions fine.

バグの修正

  • Fix a bug where the Paste configuration's unicode_path_segments (and os.environ's BFG_UNICODE_PATH_SEGMENTS) may have been defaulting to false in some circumstances. It now always defaults to true, matching the documentation and intent.
  • The repoze.bfg.traversal.find_model API did not work properly when passed a path argument which was unicode and contained high-order bytes when the unicode_path_segments or BFG_UNICODE_PATH_SEGMENTS configuration variables were "true".
  • A new module was added: repoze.bfg.settings. This contains deployment-settings-related code.

Implementation Changes

  • The make_app callable within repoze.bfg.router now registers the root_policy argument as a utility (unnamed, using the new repoze.bfg.interfaces.IRootFactory as a provides interface) rather than passing it as the first argument to the repoze.bfg.router.Router class. As a result, the repoze.bfg.router.Router router class only accepts a single argument: registry. The repoze.bfg.router.Router class retrieves the root policy via a utility lookup now. The repoze.bfg.router.make_app API also now performs some important application registrations that were previously handled inside repoze.bfg.registry.makeRegistry.

New Modules

  • A repoze.bfg.settings module was added. It contains code related to deployment settings. Most of the code it contains was moved to it from the repoze.bfg.registry module.

行動の変化

  • The repoze.bfg.settings.Settings class (an instance of which is registered as a utility providing repoze.bfg.interfaces.ISettings when any application is started) now automatically calls repoze.bfg.settings.get_options on the options passed to its constructor. This means that usage of get_options within an application's make_app function is no longer required (the "raw" options dict or None may be passed).
  • Remove old cold which attempts to recover from trying to unpickle a z3c.pt template; Chameleon has been the templating engine for a good long time now. Running repoze.bfg against a sandbox that has pickled z3c.pt templates it will now just fail with an unpickling error, but can be fixed by deleting the template cache files.

廃止

  • Moved the repoze.bfg.registry.Settings class. This has been moved to repoze.bfg.settings.Settings. A deprecation warning is issued when it is imported from the older location.
  • Moved the repoze.bfg.registry.get_options function This has been moved to repoze.bfg.settings.get_options. A deprecation warning is issued when it is imported from the older location.
  • The repoze.bfg.interfaces.IRootPolicy interface was renamed within the interfaces package. It has been renamed to IRootFactory. A deprecation warning is issued when it is imported from the older location.

0.6.1 (2009-01-06)

New Modules

  • A new module repoze.bfg.url has been added. It contains the model_url API (moved from repoze.bfg.traversal) and an implementation of urlencode (like Python's urllib.urlencode) which can handle Unicode keys and values in parameters to the query argument.

廃止

  • The model_url function has been moved from repoze.bfg.traversal into repoze.bfg.url. It can still be imported from repoze.bfg.traversal but an import from repoze.bfg.traversal will emit a DeprecationWarning.

特徴

  • A static helper class was added to the repoze.bfg.views module. Instances of this class are willing to act as BFG views which return static resources using files on disk. See the repoze.bfg.view docs for more info.
  • The repoze.bfg.url.model_url API (nee' repoze.bfg.traversal.model_url) now accepts and honors a keyword argument named query. The value of this argument will be used to compose a query string, which will be attached to the generated URL before it is returned. See the API docs (in the docs directory or on the web) for more information.

0.6 (2008-12-26)

後方の非互換性

  • Rather than prepare the "stock" implementations of the ZCML directives from the zope.configuration package for use under repoze.bfg, repoze.bfg now makes available the implementations of directives from the repoze.zcml package (see http://static.repoze.org/zcmldocs). As a result, the repoze.bfg package now depends on the repoze.zcml package, and no longer depends directly on the zope.component, zope.configuration, zope.interface, or zope.proxy packages.

    The primary reason for this change is to enable us to eventually reduce the number of inappropriate repoze.bfg Zope package dependencies, as well as to shed features of dependent package directives that don't make sense for repoze.bfg.

    Note that currently the set of requirements necessary to use bfg has not changed. This is due to inappropriate Zope package requirements in chameleon.zpt, which will hopefully be remedied soon. NOTE: in lemonade index a 1.0b8-repozezcml0 package exists which does away with these requirements.

  • BFG applications written prior to this release which expect the "stock" zope.component ZCML directive implementations (e.g. adapter, subscriber, or utility) to function now must either 1) include the meta.zcml file from zope.component manually (e.g. <include package="zope.component" file="meta.zcml">) and include the zope.security package as an install_requires dependency or 2) change the ZCML in their applications to use the declarations from repoze.zcml instead of the stock declarations. repoze.zcml only makes available the adapter, subscriber and utility directives.

    In short, if you've got an existing BFG application, after this update, if your application won't start due to an import error for "zope.security", the fastest way to get it working again is to add zope.security to the "install_requires" of your BFG application's setup.py, then add the following ZCML anywhere in your application's configure.zcml:

    <include package="zope.component" file="meta.zcml">
    

    Then re-setup.py develop or reinstall your application.

  • The http://namespaces.repoze.org/bfg XML namespace is now the default XML namespace in ZCML for paster-generated applications. The docs have been updated to reflect this.

  • The copies of BFG's meta.zcml and configure.zcml were removed from the root of the repoze.bfg package. In 0.3.6, a new package named repoze.bfg.includes was added, which contains the "correct" copies of these ZCML files; the ones that were removed were for backwards compatibility purposes.

  • The BFG view ZCML directive no longer calls zope.component.interface.provideInterface for the for interface. We don't support provideInterface in BFG because it mutates the global registry.

Other

  • The minimum requirement for chameleon.core is now 1.0b13. The minimum requirement for chameleon.zpt is now 1.0b8. The minimum requirement for chameleon.genshi is now 1.0b2.
  • Updated paster template "ez_setup.py" to one that requires setuptools 0.6c9.
  • Turn view_execution_permitted from the repoze.bfg.view module into a documented API.
  • Doc cleanups.
  • Documented how to create a view capable of serving static resources.

0.5.6 (2008-12-18)

  • Speed up traversal.model_url execution by using a custom url quoting function instead of Python's urllib.quote, by caching URL path segment quoting and encoding results, by disusing Python's urlparse.urljoin in favor of a simple string concatenation, and by using ob.__class__ is unicode rather than isinstance(ob, unicode) in one strategic place.

0.5.5 (2008-12-17)

後方の非互換性

  • In the past, during traversal, the ModelGraphTraverser (the default traverser) always passed each URL path segment to any __getitem__ method of a model object as a byte string (a str object). Now, by default the ModelGraphTraverser attempts to decode the path segment to Unicode (a unicode object) using the UTF-8 encoding before passing it to the __getitem__ method of a model object. This makes it possible for model objects to be dumber in __getitem__ when trying to resolve a subobject, as model objects themselves no longer need to try to divine whether or not to try to decode the path segment passed by the traverser.

    Note that since 0.5.4, URLs generated by repoze.bfg's model_url API will contain UTF-8 encoded path segments as necessary, so any URL generated by BFG itself will be decodeable by the traverser. If another application generates URLs to a BFG application, to be resolved successully, it should generate the URL with UTF-8 encoded path segments to be successfully resolved. The decoder is not at all magical: if a non-UTF-8-decodeable path segment (e.g. one encoded using UTF-16 or some other insanity) is passed in the URL, BFG will raise a TypeError with a message indicating it could not decode the path segment.

    To turn on the older behavior, where path segments were not decoded to Unicode before being passed to model object __getitem__ by the traverser, and were passed as a raw byte string, set the unicode_path_segments configuration setting to a false value in your BFG application's section of the paste .ini file, for example:

    unicode_path_segments = False
    

    Or start the application using the BFG_UNICODE_PATH_SEGMENT envvar set to a false value:

    BFG_UNICODE_PATH_SEGMENTS=0
    

0.5.4 (2008-12-13)

後方の非互換性

  • URL-quote "extra" element names passed in as **elements to the traversal.model_url API. If any of these names is a Unicode string, encode it to UTF-8 before URL-quoting. This is a slight backwards incompatibility that will impact you if you were already UTF-8 encoding or URL-quoting the values you passed in as elements to this API.

Bugfixes

  • UTF-8 encode each segment in the model path used to generate a URL before url-quoting it within the traversal.model_url API. This is a bugfix, as Unicode cannot always be successfully URL-quoted.

特徴

  • Make it possible to run unit tests using a buildout-generated Python "interpreter".
  • Add request.root to router.Router in order to have easy access to the application root.

0.5.3 (2008-12-07)

  • Remove the ITestingTemplateRenderer interface. When testing.registerDummyRenderer is used, it instead registers a dummy implementation using ITemplateRenderer interface, which is checked for when the built-in templating facilities do rendering. This change also allows developers to make explcit named utility registrations in the ZCML registry against ITemplateRenderer; these will be found before any on-disk template is looked up.

0.5.2 (2008-12-05)

  • The component registration handler for views (functions or class instances) now observes component adaptation annotations (see zope.component.adaptedBy) and uses them before the fallback values for for_ and request_type. This change does not affect existing code insomuch as the code does not rely on these defaults when an annotation is set on the view (unlikely). This means that for a new-style class you can do zope.component.adapts(ISomeContext, ISomeRequest) at class scope or at module scope as a decorator to a bfg view function you can do @zope.component.adapter(ISomeContext, ISomeRequest). This differs from r.bfg.convention inasmuch as you still need to put something in ZCML for the registrations to get done; it's only the defaults that will change if these declarations exist.
  • Strip all slashes from end and beginning of path in clean_path within traversal machinery.

0.5.1 (2008-11-25)

  • Add keys, items, and values methods to testing.DummyModel.
  • Add __delitem__ method to testing.DummyModel.

0.5.0 (2008-11-18)

  • Fix ModelGraphTraverser; don't try to change the __name__ or __parent__ of an object that claims it implements ILocation during traversal even if the __name__ or __parent__ of the object traversed does not match the name used in the traversal step or the or the traversal parent . Rationale: it was insane to do so. This bug was only found due to a misconfiguration in an application that mistakenly had intermediate persistent non-ILocation objects; traversal was causing a persistent write on every request under this setup.
  • repoze.bfg.location.locate now unconditionally sets __name__ and __parent__ on objects which provide ILocation (it previously only set them conditionally if they didn't match attributes already present on the object via equality).

0.4.9 (2008-11-17)

  • Add chameleon text template API (chameleon ${name} renderings where the template does not need to be wrapped in any containing XML).
  • Change docs to explain install in terms of a virtualenv (unconditionally).
  • Make pushpage decorator compatible with repoze.bfg.convention's bfg_view decorator when they're stacked.
  • Add content_length attribute to testing.DummyRequest.
  • Change paster template tests.py to include a true unit test. Retain old test as an integration test. Update documentation.
  • Document view registrations against classes and repoze.bfg.convention in context.
  • Change the default paster template to register its single view against a class rather than an interface.
  • Document adding a request type interface to the request via a subscriber function in the events narrative documentation.

0.4.8 (2008-11-12)

後方の非互換性

  • repoze.bfg.traversal.model_url now always appends a slash to all generated URLs unless further elements are passed in as the third and following arguments. Rationale: views often use model_url without the third-and-following arguments in order to generate a URL for a model in order to point at the default view of a model. The URL that points to the default view of the root model is technically http://mysite/ as opposed to http://mysite (browsers happen to ask for '/' implicitly in the GET request). Because URLs are never automatically generated for anything except models by model_url, and because the root model is not really special, we continue this pattern. The impact of this change is minimal (at most you will have too many slashes in your URL, which BFG deals with gracefully anyway).

0.4.7 (2008-11-11)

特徴

  • Allow testing.registerEventListener to be used with Zope 3 style "object events" (subscribers accept more than a single event argument). We extend the list with the arguments, rather than append.

0.4.6 (2008-11-10)

バグの修正

  • The model_path and model_url traversal APIs returned the wrong value for the root object (e.g. model_path returned '' for the root object, while it should have been returning '/').

0.4.5 (2008-11-09)

特徴

  • Added a clone method and a __contains__ method to the DummyModel testing object.
  • Allow DummyModel objects to receive extra keyword arguments, which will be attached as attributes.
  • The DummyTemplateRenderer now returns self as its implementation.

0.4.4 (2008-11-08)

特徴

  • Added a repoze.bfg.testing module to attempt to make it slightly easier to write unittest-based automated tests of BFG applications. Information about this module is in the documentation.
  • The default template renderer now supports testing better by looking for ITestingTemplateRenderer using a relative pathname. This is exposed indirectly through the API named registerTemplateRenderer in repoze.bfg.testing.

廃止

  • The names repoze.bfg.interfaces.ITemplate , repoze.bfg.interfaces.ITemplateFactory and repoze.bfg.interfaces.INodeTemplate have been deprecated. These should now be imported as repoze.bfg.interfaces.ITemplateRenderer and repoze.bfg.interfaces.ITemplateRendererFactory, and INodeTemplateRenderer respectively.
  • The name repoze.bfg.chameleon_zpt.ZPTTemplateFactory is deprecated. Use repoze.bfg.chameleon_zpt.ZPTTemplateRenderer.
  • The name repoze.bfg.chameleon_genshi.GenshiTemplateFactory is deprecated. Use repoze.bfg.chameleon_genshi.GenshiTemplateRenderer.
  • The name repoze.bfg.xslt.XSLTemplateFactory is deprecated. Use repoze.bfg.xslt.XSLTemplateRenderer.

0.4.3 (2008-11-02)

バグの修正

  • Not passing the result of "get_options" as the second argument of make_app could cause attribute errors when attempting to look up settings against the ISettings object (internal). Fixed by giving the Settings objects defaults for debug_authorization and debug_notfound.
  • Return an instance of Allowed (rather than True) from has_permission when no security policy is in use.
  • Fix bug where default deny in authorization check would throw a TypeError (use ACLDenied instead of Denied).

0.4.2 (2008-11-02)

特徴

  • Expose a single ILogger named "repoze.bfg.debug" as a utility; this logger is registered unconditionally and is used by the authorization debug machinery. Applications may also make use of it as necessary rather than inventing their own logger, for convenience.
  • The BFG_DEBUG_AUTHORIZATION envvar and the debug_authorization config file value now only imply debugging of view-invoked security checks. Previously, information was printed for every call to has_permission as well, which made output confusing. To debug has_permission checks and other manual permission checks, use the debugger and print statements in your own code.
  • Authorization debugging info is now only present in the HTTP response body oif debug_authorization is true.
  • The format of authorization debug messages was improved.
  • A new BFG_DEBUG_NOTFOUND envvar was added and a symmetric debug_notfound config file value was added. When either is true, and a NotFound response is returned by the BFG router (because a view could not be found), debugging information is printed to stderr. When this value is set true, the body of HTTPNotFound responses will also contain the same debugging information.
  • Allowed and Denied responses from the security machinery are now specialized into two types: ACL types, and non-ACL types. The ACL-related responses are instances of repoze.bfg.security.ACLAllowed and repoze.bfg.security.ACLDenied. The non-ACL-related responses are repoze.bfg.security.Allowed and repoze.bfg.security.Denied. The allowed-type responses continue to evaluate equal to things that themselves evaluate equal to the True boolean, while the denied-type responses continue to evaluate equal to things that themselves evaluate equal to the False boolean. The only difference between the two types is the information attached to them for debugging purposes.
  • Added a new BFG_DEBUG_ALL envvar and a symmetric debug_all config file value. When either is true, all other debug-related flags are set true unconditionally (e.g. debug_notfound and debug_authorization).

ドキュメンテーション

  • Added info about debug flag changes.
  • Added a section to the security chapter named "Debugging Imperative Authorization Failures" (for e.g. has_permssion).

バグの修正

  • Change default paster template generator to use Paste#http server rather than PasteScript#cherrpy server. The cherrypy server has a security risk in it when REMOTE_USER is trusted by the downstream application.

0.4.1 (2008-10-28)

バグの修正

  • If the render_view_to_response function was called, if the view was found and called, but it returned something that did not implement IResponse, the error would pass by unflagged. This was noticed when I created a view function that essentially returned None, but received a NotFound error rather than a ValueError when the view was rendered. This was fixed.

0.4.0 (2008-10-03)

ドキュメント

  • An "Environment and Configuration" chapter was added to the narrative portion of the documentation.

特徴

  • Ensure bfg doesn't generate warnings when running under Python 2.6.
  • The environment variable BFG_RELOAD_TEMPLATES is now available (serves the same purpose as reload_templates in the config file).
  • A new configuration file option debug_authorization was added. This turns on printing of security authorization debug statements to sys.stderr. The BFG_DEBUG_AUTHORIZATION environment variable was also added; this performs the same duty.

バグの修正

  • The environment variable BFG_SECURITY_DEBUG did not always work. It has been renamed to BFG_DEBUG_AUTHORIZATION and fixed.

廃止

  • A deprecation warning is now issued when old API names from the repoze.bfg.templates module are imported.

Backwards incompatibilities

  • The BFG_SECURITY_DEBUG environment variable was renamed to BFG_DEBUG_AUTHORIZATION.

0.3.9 (2008-08-27)

特徴

  • A repoze.bfg.location API module was added.

Backwards incompatibilities

  • Applications must now use the repoze.bfg.interfaces.ILocation interface rather than zope.location.interfaces.ILocation to represent that a model object is "location-aware". We've removed a dependency on zope.location for cleanliness purposes: as new versions of zope libraries are released which have improved dependency information, getting rid of our dependence on zope.location will prevent a newly installed repoze.bfg application from requiring the zope.security, egg, which not truly used at all in a "stock" repoze.bfg setup. These dependencies are still required by the stack at this time; this is purely a futureproofing move.

    The security and model documentation for previous versions of repoze.bfg recommended using the zope.location.interfaces.ILocation interface to represent that a model object is "location-aware". This documentation has been changed to reflect that this interface should now be imported from repoze.bfg.interfaces.ILocation instead.

0.3.8 (2008-08-26)

ドキュメント

  • Documented URL dispatch better in narrative form.

バグの修正

  • Routes URL dispatch did not have access to the WSGI environment, so conditions such as method=GET did not work.

特徴

  • Add principals_allowed_by_permission API to security module.
  • Replace z3c.pt support with support for chameleon.zpt. Chameleon is the new name for the package that used to be named z3c.pt. NOTE: If you update a repoze.bfg SVN checkout that you're using for development, you will need to run "setup.py install" or "setup.py develop" again in order to obtain the proper Chameleon packages. z3c.pt is no longer supported by repoze.bfg. All API functions that used to render z3c.pt templates will work fine with the new packages, and your templates should render almost identically.
  • Add a repoze.bfg.chameleon_zpt module. This module provides Chameleon ZPT support.
  • Add a repoze.bfg.xslt module. This module provides XSLT support.
  • Add a repoze.bfg.chameleon_genshi module. This provides direct Genshi support, which did not exist previously.

廃止

  • Importing API functions directly from repoze.bfg.template is now deprecated. The get_template, render_template, render_template_to_response functions should now be imported from repoze.chameleon_zpt. The render_transform, and render_transform_to_response functions should now be imported from repoze.bfg.xslt. The repoze.bfg.template module will remain around "forever" to support backwards compatibility.

0.3.7 (2008-09-09)

特徴

  • Add compatibility with z3c.pt 1.0a7+ (z3c.pt became a namespace package).

バグの修正

  • repoze.bfg.traversal.find_model function did not function properly.

0.3.6 (2008-09-04)

特徴

  • Add startup process docs.
  • Allow configuration cache to be bypassed by actions which include special "uncacheable" discriminators (for actions that have variable results).

バグの修正

  • Move core repoze.bfg ZCML into a repoze.bfg.includes package so we can use repoze.bfg better as a namespace package. Adjust the code generator to use it. We've left around the configure.zcml in the repoze.bfg package directly so as not to break older apps.
  • When a zcml application registry cache was unpickled, and it contained a reference to an object that no longer existed (such as a view), bfg would not start properly.

0.3.5 (2008-09-01)

特徴

  • Event notification is issued after application is created and configured (IWSGIApplicationCreatedEvent).
  • New API module: repoze.bfg.view. This module contains the functions named render_view_to_response, render_view_to_iterable, render_view and is_response, which are documented in the API docs. These features aid programmatic (non-server-driven) view execution.

0.3.4 (2008-08-28)

Backwards incompatibilities

  • Make repoze.bfg a namespace package so we can allow folks to create subpackages (e.g. repoze.bfg.otherthing) within separate eggs. This is a backwards incompatible change which makes it impossible to import "make_app" and "get_options" from the repoze.bfg module directly. This change will break all existing apps generated by the paster code generator. Instead, you need to import these functions as repoze.bfg.router:make_app and repoze.bfg.registry:get_options, respectively. Sorry folks, it has to be done now or never, and definitely better now.

特徴

  • Add model_path API function to traversal module.

Bugfixes

  • Normalize path returned by repoze.bfg.caller_path.

0.3.3 (2008-08-23)

  • Fix generated test.py module to use project name rather than package name.

0.3.2 (2008-08-23)

  • Remove sampleapp sample application from bfg package itself.
  • Remove dependency on FormEncode (only needed by sampleapp).
  • Fix paster template generation so that case-sensitivity is preserved for project vs. package name.
  • Depend on z3c.pt version 1.0a1 (which requires the [lxml] extra currently).
  • Read and write a pickled ZCML actions list, stored as configure.zcml.cache next to the applications's "normal" configuration file. A given bfg app will usually start faster if it's able to read the pickle data. It fails gracefully to reading the real ZCML file if it cannot read the pickle.

0.3.1 (2008-08-20)

  • Generated application differences: make_app entry point renamed to app in order to have a different name than the bfg function of the same name, to prevent confusion.
  • Add "options" processing to bfg's make_app to support runtime options. A new API function named get_options was added to the registry module. This function is typically used in an application's app entry point. The Paste config file section for the app can now supply the reload_templates option, which, if true, will prevent the need to restart the appserver in order for z3c.pt or XSLT template changes to be detected.
  • Use only the module name in generated project's "test_suite" (run all tests found in the package).
  • Default port for generated apps changed from 5432 to 6543 (Postgres default port is 6543).

0.3.0 (2008-08-16)

  • Add get_template API to template module.

0.2.9 (2008-08-11)

  • 0.2.8 was "brown bag" release. It didn't work at all. Symptom: ComponentLookupError when trying to render a page.

0.2.8 (2008-08-11)

  • Add find_model and find_root traversal APIs. In the process, make ITraverser a uni-adapter (on context) rather than a multiadapter (on context and request).

0.2.7 (2008-08-05)

  • Add a request_type attribute to the available attributes of a bfg:view configure.zcml element. This attribute will have a value which is a dotted Python path, pointing at an interface. If the request object implements this interface when the view lookup is performed, the appropriate view will be called. This is meant to allow for simple "skinning" of sites based on request type. An event subscriber should attach the interface to the request on ingress to support skins.
  • Remove "template only" views. These were just confusing and were never documented.
  • Small url dispatch overhaul: the connect method of the urldispatch.RoutesMapper object now accepts a keyword parameter named context_factory. If this parameter is supplied, it must be a callable which returns an instance. This instance is used as the context for the request when a route is matched.
  • The registration of a RoutesModelTraverser no longer needs to be performed by the application; it's in the bfg ZCML now.

0.2.6 (2008-07-31)

  • Add event sends for INewRequest and INewResponse. See the events.rst chapter in the documentation's api directory.

0.2.5 (2008-07-28)

  • Add model_url API.

0.2.4 (2008-07-27)

  • Added url-based dispatch.

0.2.3 (2008-07-20)

  • Add API functions for authenticated_userid and effective_principals.

0.2.2 (2008-07-20)

  • Add authenticated_userid and effective_principals API to security policy.

0.2.1 (2008-07-20)

  • Add find_interface API.

0.2 (2008-07-19)

  • Add wsgiapp decorator.
  • The concept of "view factories" was removed in favor of always calling a view, which is a callable that returns a response directly (as opposed to returning a view). As a result, the factory attribute in the bfg:view ZCML statement has been renamed to view. Various interface names were changed also.
  • render_template and render_transform no longer return a Response object. Instead, these return strings. The old behavior can be obtained by using render_template_to_response and render_transform_to_response.
  • Added 'repoze.bfg.push:pushpage' decorator, which creates BFG views from callables which take (context, request) and return a mapping of top-level names.
  • Added ACL-based security.
  • Support for XSLT templates via a render_transform method

0.1 (2008-07-08)

  • Initial release.