root / pycommunity / pycommunity / doc / configuration.txt

Revision 78:b5dabe9762d1, 1.5 kB (checked in by Tarek Ziad?? <tarek@…>, 16 months ago)

rupy slides, starting up

Line 
1=============
2configuration
3=============
4$Id:$
5
6`configuration` provides a class to read config files::
7
8    >>> from configuration import Configuration
9    >>> config = Configuration('tests/pycommunity.conf')
10
11packages, recipes, and tutorials folders can be read with
12direct methods::
13   
14    >>> config.recipes
15    {'recipes': 'tests/svn/project/recipes'}
16    >>> tuts = config.tutorials.items()
17    >>> tuts.sort()
18    >>> tuts
19    [('tuts', 'tests/svn/project/tutorials')]
20    >>> config.glossary
21    '/etc/pycommunity/glossary.txt'
22    >>> packages = config.packages.items()
23    >>> packages.sort()
24    >>> packages
25    [('package1', 'tests/svn/project/src/package1')]
26    >>> config.targets
27    {'target1': 'tests/www'}
28    >>> templates = config.templates.items()
29    >>> templates.sort()
30    >>> templates
31    [('css', 'tests/templates/pycommunity.css'),
32     ('glossary', 'tests/templates/glossary.pt'),
33     ('index', 'tests/templates/index.pt'),
34     ('js', 'tests/templates/pycommunity.js'),
35     ('packagedoc', 'tests/templates/packagedoc.pt'),
36     ('packageindex', 'tests/templates/packageindex.pt'),
37     ('packagesindex', 'tests/templates/packagesindex.pt'),
38     ('packagestats', 'tests/templates/packagestats.pt'),
39     ('recipe', 'tests/templates/recipe.pt'),
40     ('recipelist', 'tests/templates/recipelist.pt'),
41     ('tutorial', 'tests/templates/tutorial.pt'),
42     ('tutoriallist', 'tests/templates/tutoriallist.pt')]   
43    >>> config.media
44    'tests/templates/media'
45    >>> 'projectname' in config.options
46    True
Note: See TracBrowser for help on using the browser.