[PEAK] References between models

Radek Kanovsky rk at dat.cz
Thu Nov 13 11:32:30 EST 2003


On Thu, Nov 13, 2003 at 05:14:02PM +0100, Radek Kanovsky wrote:

>     my_app.ini:
> 
>         [mylib.contact]
>         # I declare that "mylib.contact.model.Contact" property
>         # is "mylib.contact.model.Contact" class.
>         #
>         # This is default only for mylib.contact.storage.ContactDM
>         # (not for mylib.invoice.model.Invoice) so I must declare
>         # the property explicitely.
>         
>         model.Contact = importString("mylib.contact.model:Contact")
> 
>         # I can replace this default Contact model with other one. 
>         #
>         #   model.Contact = importString("yourlib.kontakt.model:Kontakt")
>         #
>         # Of course, there must be also special data manager for the
>         # Kontakt in application if default ContactDM refuses work
>         # with Kontakt.
> 
> 
>         [mylib.invoice]
>         # This is useless definition. Invoice is not referenced
>         # from other places and InvoiceDM has default model.Invoice.
>         
>         model.Invoice = importString("mylib.invoice.model:Invoice")

This will not work. "mylib.invoice.model:Invoice" is ElementTemplate
so there must be some other mechanism how to obtain Elements.

``importString("mylib.contact.model:Contact")'' should work as expected
because Contact class is Element and not ElementTemplate.


Radek Kanovsky



More information about the PEAK mailing list