On 10/29/10 10:59 AM, Dermot McCluskey wrote:
> Resending, as I forgot to cc: the alias the first time.
> 
> - Dermot
> 
> 
> -------- Original Message --------
>>>>
>>>> [2] usr/src/cmd/distro_const/__init__.py
> 
> 44:
> I know there was some discussion about where is the correct place
> to register DOC classes - separately in the modules where they are
> defined or all together in the main app.
> I thought the correct place was in the modules, not in the app? eg
> the Checkpoint class would be registered in the target_spec module?
> Did Darren make a statement on this?
> 

The expected behaviour w.r.t. the registering of classes was meant to be that it
would happen when anyone imported the specific module that the class was
implemented in.

For example, if a class is defined in module a.b.c, then when the consuming
module imports that module the classes in the module would be registered. In
this case it would be most likely (but not the only way) done in the
a/b/c/__init__.py file, or the a/b/__init__.py file if c is a/b/c.py.

The general idea - at least for applications like AI, where the checkpoints are
known in advance - is that the application would simply do :

        from solaris_install.x.y import CheckpointY

then this would result in the DataObject class being registered because it's
done in solaris_install/x/__init__.py.

Of course, DC breaks this rule a little, in that it doesn't know all the
possible checkpoints in advance since they largely come from the manifest 
itself.

So, I think DC should only be considering the modules it uses, and not refer to
the classes in those modules directly.

The latest webrev kinda does this, but Drew was also speaking to me yesterday
about the idea that it would be possible to register all DataObject classes in a
module using a call like:

        DataObjectCache.register_class(module.x.y)

which would in turn look in that module, for defined classes, and register them
(if they implement DataObjectBase).

An enhancement to the DOC would facilitate this, and make it a little cleaner
for DC. Could someone please log such a bug, and I'll follow up on it.

Thanks,

Darren.
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to