Mercurial > hg > pyloader
comparison README.txt @ 40:0b2019d0af98
finalize (hopefully) decorator syntax
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Wed, 08 Jun 2011 08:36:32 -0700 |
| parents | db095765807d |
| children | c852ff04c940 |
comparison
equal
deleted
inserted
replaced
| 39:db095765807d | 40:0b2019d0af98 |
|---|---|
| 82 [include:%(here)s/some/file.ini] | 82 [include:%(here)s/some/file.ini] |
| 83 | 83 |
| 84 INI files have a few convenience variables: | 84 INI files have a few convenience variables: |
| 85 | 85 |
| 86 - %(here)s : the location of the directory the .ini file lives in | 86 - %(here)s : the location of the directory the .ini file lives in |
| 87 - %(app)s : used for wrappers | 87 - %(object)s : used for wrappers |
| 88 | 88 |
| 89 Additional variables may be provided by the consumer. | 89 Additional variables may be provided by the consumer. |
| 90 | |
| 91 Summary of .ini decorator syntax | |
| 92 -------------------------------- | |
| 93 | |
| 94 1. ``[foo:%(here)s/objects.py:MyClass]``: create object ``foo`` of type | |
| 95 ``MyClass`` using arguments given from the section | |
| 96 | |
| 97 2. ``[foo:bar]``: create object ``foo`` using the pattern from section | |
| 98 ``bar`` but overriding any arguments in the ``bar`` section with | |
| 99 those from this section | |
| 100 | |
| 101 3. ``[foo:bar:%(here)s/objects.py:MyClass]``: create object ``foo`` | |
| 102 which is an instance of ``MyClass`` wrapped in the object created by | |
| 103 the ``bar`` pattern. ``bar`` is passed a special argument, | |
| 104 ``%(object)s`` which is the instance of the wrapped object (the | |
| 105 ``MyClass`` instance). Internally, the wrapped object is known by | |
| 106 the whole section name (``foo:bar:%(here)s/objects.py:MyClass``). The | |
| 107 arguments in this section apply to ``MyClass(...)`` | |
| 108 | |
| 109 4. ``[foo:bar:app=%(object)s,value=1:%(here)s/objects.py:MyClass]``: | |
| 110 the same as 3. but override the values in the ``bar`` section with | |
| 111 ``app=%(object)s`` and ``value=1`` | |
| 112 | |
| 113 * ``[name:path]`` | |
| 114 * ``[name:decorator:path]`` | |
| 115 * ``[name:decorator:overrides:path]`` | |
| 90 | 116 |
| 91 ---- | 117 ---- |
| 92 | 118 |
| 93 Jeff Hammel | 119 Jeff Hammel |
| 94 http://k0s.org/ | 120 http://k0s.org/ |
