soult/tinyback — pull request #4 by alard (2012-10-15 21:25:17+00:00)
Title: Some improvements for the warrior

One commit prints the number of codes examined and URLs found at the end, which is nice if you're watching the warrior.

The second commit makes sure that you're getting the most recent username from the warrior, even if the user changes it in the config screen.

--

Let me abuse this pull request for a little bit of warrior documentation (which is sorely missing).

If you do this, you retrieve the downloader name only when your project starts:
````python
ExternalProcess("TinyBack",
[ "./run.py", ...,
"--username=" + downloader ])
````
The downloader value gets added to the username when the pipeline is evaluated and that's it.

If you want to follow the changes the user makes in the configuration screen, it is better to keep the downloader as a separate object:
````python
ExternalProcess("TinyBack",
[ "./run.py", ...,
"--username", downloader ])
````

The `downloader` variable is a an instance of `ConfigValue` (or a string). When a task needs the value of that variable it uses the warrior's `realize` function to replace it with the current value. Since this happens each time the task is executed, you'll always have the most recent username. This only works if it is still a `ConfigValue`.

Alternatively, if you want to include the downloader name as part of a string, you could wrap the full string in a `ConfigInterpolation` object. For example:
````python
ExternalProcess("TinyBack",
[ "./run.py", ...,
ConfigInterpolation("--user=%s", downloader) ])
````
This `ConfigInterpolation` will be evaluated every time the task runs.