[TransWarp] Domain model objects as utilities?

Phillip J. Eby pje at telecommunity.com
Fri Oct 17 23:16:53 EDT 2003


At 06:02 PM 10/17/03 -0700, John Landahl wrote:
>On Fri, 17 Oct 2003 19:18:03 -0400, Phillip J. Eby <pje at telecommunity.com> 
>wrote:
>
>>If you're loading an .ini file into your app component, you can still use 
>>[Provide Utilities], and all your utilities will be loaded using the app 
>>component as their parent, so they'll be able to relate to one another 
>>properly.
>
>Ah ha!  That sounds just just the right thing.  I'm not sure I'd know how 
>to accomplish it, though.  Or are you saying that this is already 
>happening?  It doesn't seem that my classes from [Provide Utilities] know 
>about app-object components, though.

See 'config.loadConfigFile()'.  You can slap a usage of it in an 
uponAssembly binding if you want to load a configuration file on startup, e.g.:

class MyApp(binding.Component):

     __loadConfig = binding.Make(
         lambda self: config.loadConfigFile(self, self.configFilename),
         uponAssembly = True
     )


Anything loaded into your app component will take precedence over settings 
in the config root, at least from your app component down.  It won't affect 
parents or peers of your app component, but you probably don't have any 
parents but the root, and no peers.




More information about the PEAK mailing list