Mercurial > hg > pyloader
comparison README.txt @ 8:4d3ea44fd813
further spec out
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Wed, 25 May 2011 09:00:28 -0700 |
| parents | 79676a48f6d8 |
| children | ff634cc2e62b |
comparison
equal
deleted
inserted
replaced
| 7:79676a48f6d8 | 8:4d3ea44fd813 |
|---|---|
| 40 section name contains the object name (e.g. ``foo``) followed by a | 40 section name contains the object name (e.g. ``foo``) followed by a |
| 41 ``:`` followed by a loading path. Like JSON, a dotted path or a file | 41 ``:`` followed by a loading path. Like JSON, a dotted path or a file |
| 42 path may be used. In addition, other (pluggable) loading paths are | 42 path may be used. In addition, other (pluggable) loading paths are |
| 43 available: | 43 available: |
| 44 | 44 |
| 45 - override loader: [TODO] | 45 - override loader: you can use a section name like ``[foo:bar]`` to |
| 46 override variables from the ``bar`` object with variables from | |
| 47 ``foo``:: | |
| 48 | |
| 49 [foo:bar] | |
| 50 . = cats, dogs | |
| 51 type = count | |
| 52 | |
| 53 [bar:%(here)s/some/path.py:MyObject] | |
| 54 . = elephants | |
| 55 type = concatenate | |
| 56 | |
| 57 The above results in a JSON blob for foo like:: | |
| 58 | |
| 59 {'foo': {'args': ['elephants', 'cats', 'dogs'], | |
| 60 'kwargs': {'type': 'concatenate'}, | |
| 61 'path': '/location/of/ini/file/some/path.py:MyObject'}} | |
| 62 | |
| 63 ``args`` is extended. ``kwargs`` will be overridden. | |
| 64 | |
| 65 - wrappers: | |
| 46 | 66 |
| 47 In addition, .ini files may include other .ini files. This allows for | 67 In addition, .ini files may include other .ini files. This allows for |
| 48 encapsulation of intent of specific .ini files. | 68 encapsulation of intent of specific .ini files:: |
| 49 | 69 |
| 70 [include:%(here)s/some/file.ini] | |
| 71 | |
| 72 INI files have a few convenience variables: | |
| 73 | |
| 74 - %(here)s : the location of the directory the .ini file lives in | |
| 75 - %(app)s : used for wrappers | |
| 76 | |
| 77 Additional variables may be provided by the consumer. | |
| 50 | 78 |
| 51 ---- | 79 ---- |
| 52 | 80 |
| 53 Jeff Hammel | 81 Jeff Hammel |
| 54 http://k0s.org/ | 82 http://k0s.org/ |
