File: tips.txt

package info (click to toggle)
python-paver 1.2.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 1,220 kB
  • sloc: python: 4,678; makefile: 20
file content (22 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
***************
Tips and Tricks
***************

Using a Config File For Settings
--------------------------------

Many people like to have their configuration metadata available in a 
*data file*, rather than a Python program. This is easy to do with
Paver::

    from paver.easy import *
    
    @task
    def auto():
        config_data = (read config data using config parser of choice)
        # assuming config_data is a dictionary
        options.update(config_data)
        
The auto task is automatically run when the pavement is launched. You can
use Python's standard ConfigParser module, if you'd like to store the
information in an .ini file.