This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Introduction

This package provides a method to configure an application via standard .ini files. This is convenient for site admins since they are more likely to be familiar with ini files than with ZCML.

Creating config files

There are two ways to tell a Zope instance which configuration files to load: zcml statements and the APPCONFIG environment variable. zcml statements are processed first, making it possible to override standard configuration.

The zcml syntax looks like this:

<configure xmlns="http://namespaces.zope.org/zope">
  <include package="z3c.appconfig" file="meta.zcml"/>
  <appconfig file="default.ini" />
</configure>

This will load the contents of default.ini and merge it into the application configuration.

If an APPCONFIG environment variable is set and points to a file its contents will be merged into the application configuration. This is done last, allowing you to override application defined defaults. For example:

$ APPCONFIG=etc/mysite.ini bin/instance fg

Accessing configuration

The configuration data can be accessed from your code via a IAppConfig utility. This utility is essentially a standard python dictionary which stores all configuration data. For example lets use a very simple configuration file:

[site]
title = My lovely site

You can access the title from python with code like this:

from zope.component import getUtility
from z3c.appconfig.interfaces import IAppConfig

appconfig=getUtility(IAppConfig)
print "Site title is: %s" % appconfig["site"]["title"]

Utility methods

As a convenience a utility method is provided to convert values from a configuration file to booleans: the z3c.appconfig.utils.asBool method:

from z3c.appconfig.utils import asBool
print "Pants are on: %s" % asBool("true")

Changelog

1.0 (2011-01-24)

  • Add more trove classifiers. [wichert]
  • Add a asBool utility method. [wichert]

1.0b1 (2010-05-17)

  • Initial release. [wichert]
Release History

Release History

1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0b1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
z3c.appconfig-1.0.tar.gz (5.7 kB) Copy SHA256 Checksum SHA256 Source Jan 24, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting