openmicroscopy/openmicroscopy — pull request #2498 by joshmoore (2014-05-14 06:28:45+00:00)
Title: tx.py CLI Command (rebased onto develop)

This is the same as gh-2409 but rebased onto develop.

----

This is the beginning of a command for creating and modifying objects from the CLI. The eventual intent is that all the operations happen within the same transaction server-side (hence the name), but for the moment all the work is happening client-side.

The immediate use case which it should satisfy is the likes of creating a `Dataset` or a `Screen` for CLI import. /CC @pwalczysko @ximenesuk More complex workflows are possible and planned, including loops, lookups, etc.

Other name proposals: `obj`, `macro`

To test:
* Try a basic creation: `bin/omero tx new Project name=foo`. This should work for any data type that isn't part of a ordered collection (like `Pixels`) and for any field of a basic type, incl `Image acquisitionDate=5`.
* Also try creating a more complicated file passing it to the command: `bin/omero tx --file=test.txt`

Example file:
```
new Project name=foo
new Dataset name=bar
new ProjectDatasetLink parent@=0 child@=1
```
Here the `@=` notation points to the N-th object created by the script (base 0). Very much looking for other uses that I haven't thought of yet.

**For the other Pythonistas** (@knabar, @cneves, @will-moore, @aleksandra-tarkowska, @chris-allan, ...) this begins work on adding meta-information to the Python model objects (that's available via reflection in Java). Each field now provides a `_wrapper` (e.g. `Image._acquisitionDate_wrapper`) which can be used to turn strings into field values. This even works for `IObjects` a la: `ProjectDatasetLink.setParent("Project:1", wrap=True)`. Again, suggestions welcome. If there is more info needed per field, I suggest we move to `Image._field_info = (wrapper, ...)`.