</Package> |
</Package> |
</DAZzle> |
</DAZzle> |
|
|
Also note that there is no particular significance to my choice of lists vs. |
Note that there is no particular significance to my choice of lists vs. tuples |
tuples in these examples; they're more to demonstrate that you can use |
in these examples; they're more to demonstrate that you can use arbitrary |
arbitrary structures, as long as they contain objects that are supported by |
structures, as long as they contain objects that are supported by either |
either ``iter_options()`` or ``add_to_package()``. Normally, you will simply |
``iter_options()`` or ``add_to_package()``. Normally, you will simply use |
use collections of either PyDicia-provided symbols, or application objects for |
collections of either PyDicia-provided symbols, or application objects for |
which you've defined an ``iter_options()`` method. |
which you've defined an ``iter_options()`` method. |
|
|
You will also usually want to implement your PyDicia support in a module by |
You will also usually want to implement your PyDicia support in a module by |
Receiving Status Updates |
Receiving Status Updates |
======================== |
======================== |
|
|
When DAZzle completes a run, it creates an output file containing status |
When DAZzle completes a batch, it creates an output file containing status |
information for each package in the batch. If you'd like to process this |
information for each package in the batch. If you'd like to process this |
status information for the corresponding application objects you passed in |
status information for the corresponding application objects you passed in |
to ``add_package()``, you can extend the ``report_status()`` generic function |
to ``add_package()``, you can extend the ``report_status()`` generic function |
TransactionDateTime : datetime.datetime(2007, 7, 4, 17, 32, 21) |
TransactionDateTime : datetime.datetime(2007, 7, 4, 17, 32, 21) |
PostmarkDate : datetime.date(2007, 7, 5) |
PostmarkDate : datetime.date(2007, 7, 5) |
|
|
The ``Status`` object should support all output fields supported by DAZzle; |
The ``Status`` object should support all output fields supported by DAZzle; see |
see the documentation for details. The non-string fields shown above are the |
the DAZzle documentation for details. The non-string fields shown above are |
only ones which are postprocessed to specialized Python objects; the rest are |
the only ones which are postprocessed to specialized Python objects; the rest |
kept as strings or Unicode values. The ``ErrorCode`` field is computed by |
are kept as strings or Unicode values. The ``ErrorCode`` field is computed by |
extracting the integer portion of any rejection code. It is ``None`` in the |
extracting the integer portion of any rejection code. It is ``None`` in the |
case of a successful live print, and ``0`` in the case of a successful test |
case of a successful live print, and ``0`` in the case of a successful test |
print. See the DAZzle XML interface documentation for a description of other |
print. See the DAZzle XML interface documentation for a description of other |
error codes. |
error codes. |
|
|
Note that fields with ``None`` values are not included in the ``str()`` of a |
Note that for a more compact presentation, attributes with ``None`` values are |
``Status`` object, for a more compact representation, which is why none of the |
not included in the ``str()`` of a ``Status`` object, which is why the statuses |
statuses displayed above. |
displayed above show different sets of fields. The attributes, however, always |
|
exist; they simply have ``None`` as their value. |
|
|
|
|
Invoking DAZzle |
Invoking DAZzle |
=============== |
=============== |
|
|
In the simplest case, invoking a batch's ``.run()`` method will launch a local |
In the simplest case, invoking a batch or shipment objects ``.run()`` method |
copy of DAZzle on a temporary file containing the batch's XML, wait for DAZzle |
will launch a local copy of DAZzle on a temporary file containing the batch's |
to exit, then process status updates from the output file and return DAZzle's |
XML, wait for DAZzle to exit, then process status updates from the output file |
return code. |
and return DAZzle's return code. (Or a list of return codes, in the case of a |
|
``Shipment``.) |
|
|
If you are using this approach, you may wish to include ``~DAZzle.Prompt`` |
If you are using this approach, you may wish to include ``~DAZzle.Prompt`` |
(which keeps end-user prompts to a minimum) and ``DAZzle.AutoClose`` (so that |
(which keeps end-user prompts to a minimum) and ``DAZzle.AutoClose`` (so that |