DotConf

Python用の高度な構成パーサー
今すぐダウンロード

DotConf ランキングとまとめ

広告

  • Rating:
  • ライセンス:
  • MIT/X Consortium Lic...
  • 価格:
  • FREE
  • 出版社名:
  • Antoine Millet
  • 出版社のWebサイト:
  • http://inaps.org

DotConf タグ


DotConf 説明

dotconfは、ネストされたセクションを任意のレベル、ファイルに含まれている値、ファイルに含まれる高度な設定パーサーです。それはまた強力なスキーマ検証システムであるsystem.examplethisです。 0.0.0.0:443 'host' example.org '{path' / '{rate_limit = 30}} host' protected.example.org '{enable_ssl = yes path' / files '{enable_auth = yes user' foo '{パスワードDotConf Import Dotconf >>> parsed_conf = dotconf.from_file( 'mywebserver.conf')>>> parsed_conf.get( 'mywebserver.conf')>>> parsed_conf.get( 'mywebserver.conf')>>> prased_conf.get( 'mywebserver.conf')>>>デーモン '、false)Trueevenより興奮している、あなたはあなたの手動構成ファイル検証の痛みを伴う雑用を避けるために検証スキーマを作成することができます:dotconf.schemaからのインポートされた多数、dotconf.schema.Containersのインポートのインポートブール値、整数、float、string#スキーマ定義:クラスUSERSECTION(セクション):password = value(string())_meta = {'repeat':多く、 'Unique':true}クラスpathsec tion(section):rate_limit = value(float_limit = 0)enable_auth = value(boolean()、default = false)user = userSection()クラスVirtualHostSection(セクション):base_path = value(string())enable_ssl = value(boolean()、default = false)path = pathSection()_meta = {'repeat':多く、 '一意':true}クラスMyWebServerConfiguration(セクション):daemon = value(boolean()default = false)pidfile = value (string()、default = none)interface = value(string()、default = '127.0.0.1:80')interface_ssl = value(string()、default = '127.0.0.1:443')host = virtualHostSection()その後、検証されていないかのようにAPIを使用することができます。 parsed_conf.get( 'daemon')デーモン:true >>> parsed_conf.subsections( 'host'):>>> print vhost.args >>> vhost.get( 'enable_ssl'):> >>プリント 'SSL Enabled' >>> VHOST.SUSECTIONS( 'path'):>>> print '' +パス.args >>> path.get( 'enable_auth'):>>> print '次のユーザーはこのディレクトリにアクセスできます。' >>> path.subsections( 'user'):>>> print ' - ' + user.args >>> example.org / protected.example.org SSL対応/ファイルは、このディレクトリにアクセスできます。 - Fooproductのホームページ


DotConf 関連ソフトウェア