Mercurial > hg > pyloader
annotate README.txt @ 7:79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
| author | Jeff Hammel <jhammel@mozilla.com> | 
|---|---|
| date | Tue, 24 May 2011 19:12:09 -0700 | 
| parents | 6fa6d987b3af | 
| children | 4d3ea44fd813 | 
| rev | line source | 
|---|---|
| 0 | 1 pyloader | 
| 2 =========== | |
| 3 | |
| 7 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 4 Load python attributes from strings | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 5 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 6 JSON Format | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 7 ----------- | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 8 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 9 pyloader uses a JSON-serializable format for the canonical | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 10 (serializable) form of python objects:: | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 11 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 12 {'foo': # (arbitrary) object name, | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 13 {'args': ['positional', 'arguments'], | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 14 'kwargs': {'keyword': 'arguments}, | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 15 'path': 'dotted.or.file.path:ObjectName'}, | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 16 'bar': ... } # etc | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 17 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 18 Objects are instantiated like:: | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 19 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 20 ObjectName(*args, **kwargs) | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 21 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 22 In the case that the object is not to be instantiated (e.g. a | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 23 standalone function, ``args`` and ``kwargs`` will either not be | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 24 present or will be None (``null`` in JSON). | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 25 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 26 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 27 INI Format | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 28 ---------- | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 29 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 30 pyloader also features an INI format which is translated to the JSON | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 31 Format but adds a few convenience features. A simple object is | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 32 expressed as:: | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 33 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 34 [foo:dotted.or.file.path:ObjectName] | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 35 . = positional, arguments | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 36 keyword = arguments | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 37 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 38 ``.`` expresses positional arguments which is a comma-separated | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 39 list. The remaining (key, value) pairs become keyword arguments. The | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 40 section name contains the object name (e.g. ``foo``) followed by a | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 41 ``:`` followed by a loading path. Like JSON, a dotted path or a file | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 42 path may be used. In addition, other (pluggable) loading paths are | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 43 available: | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 44 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 45 - override loader: [TODO] | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 46 | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 47 In addition, .ini files may include other .ini files. This allows for | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 48 encapsulation of intent of specific .ini files. | 
| 
79676a48f6d8
begin porting and modernizing instructions from wsgiblob to pyloader
 Jeff Hammel <jhammel@mozilla.com> parents: 
0diff
changeset | 49 | 
| 0 | 50 | 
| 51 ---- | |
| 52 | |
| 53 Jeff Hammel | |
| 54 http://k0s.org/ | |
| 55 | 
