On 05/26/2017 11:41 AM, Dennis Kliban wrote:
> Looking at the cast() method[0] it looks like it's possible to call cast()
> on a detail model. I would like to figure out when we expect to call cast()
> on a detail model. Without fully knowing the motivation for this
> implementation, I am inclined to raise an exception when the code reaches
> line 113. The exception would inform the developer that calling cast() is
> only appropriate on a master model.

You don't always know if you're dealing with a master model instance
or its related cast detail model instance. This method makes calling
cast on a detail instance a no-op, so it costs when you need to pay
the price, and is free when you don't. It also has the effect that
"instance is instance.cast()" when casting detail instances. As
Michael pointed out, raising an exception here would be an expection
antipattern (raising exceptions in non-exceptional cases).

On 05/26/2017 04:27 PM, Dennis Kliban wrote:
> The problem occurs when a worker receives a task to perform a publish, but
> it doesn't have the plugin installed.

The problem is that the plugin is not installed on the worker, so fix
*that* problem. Install the plugin on the worker. If anything should
raise an exception, it should be a warning on worker start that
unknown content types exist in the db, including what the master type
is and what the unknown content types are.

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Pulp-dev mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pulp-dev

Reply via email to