[00:25:46] ** whit has left IRC () [04:02:55] [connected at Wed Feb 22 04:02:55 2006] [04:02:56] <> *** Looking up your hostname... [04:02:56] <> *** Checking ident [04:02:56] <> *** Found your hostname [04:03:26] <> *** No identd (auth) response [04:03:26] <> *** Your host is calvino.freenode.net[calvino.freenode.net/6667], running version hyperion-1.0.2 [04:03:26] [I have joined #peak] [10:02:47] ** whit has joined us [11:00:31] ** hazmat_ has joined us [11:01:32] ** hazmat_ has left us [11:31:16] ** pje has joined us [16:42:56] ** erikrose has joined us [17:22:26] hi, I am creating a Component sublass outside binding.Make, should I expect it to be able to Obtain(IFoo) ? [17:28:28] I imagine this is a common use case, I am trying to make a collection of components at runtime [17:30:59] ah IConfigurable [18:26:16] IConfigurable is only needed for components that get dynamic registration at runtime [18:26:24] e.g. an IniLoader or ServiceArea [18:26:48] The standard idiom in PEAK for such is to let your ServiceArea or ConfigurationRoot get the configuration, and everything else just inherits it. [18:35:37] sorry, I don't get that [18:36:12] pje: I just want a component to create children at runtime [18:36:25] That's what binding.Make is for. [18:36:38] Unless you mean dynamically-determined children [18:36:48] yes, I think I do mean that [18:37:01] I noticed some posts about using IConfigurable, but no matter what I do I can't set the component's parent [18:37:02] Dynamically determined by what? a configuration file? [18:37:21] no, python code [18:37:31] IConfigurable doesn't have anything to do with children; it has to do with being able to register providers at runtime [18:37:34] maybe eventually a config file [18:37:57] an IConfigurable is an object that you can register interfaces or properties with at runtime [18:38:03] as opposed to class definition time. [18:38:15] In a "normal" PEAK application, there's only one IConfigurable: the ConfigurationRoot. [18:38:45] It's rare that you need any others, unless you have components with separate .ini files. [18:39:16] So if all you're trying to do is create child objects of something, IConfigurable has nothing to do with it. [18:39:41] Child objects are created simply by calling MyComponentClass(parent) [18:39:54] well, the only problem is that components I create outside binding.Make can't get object as the parent, and get none of the component hierarchy [18:40:04] ah, thanks [18:40:36] the binding descriptors all automatically "suggest" the container as a parent component to objects that don't have one. [18:40:48] But that only happens when you assign to the attribute [18:41:02] and only for attributes implemented using one of the binding descriptors. [18:42:30] (e.g. binding.Make, binding.Require, binding.Obtain) [18:42:55] right, well it is just going in a plain dict [18:43:12] I am still utterly shaky on it all :) [18:43:24] yeah, then you need either binding.suggestParentComponent() or to just create them with their parent set to start out. [18:43:40] I tried suggestParentComponent actually [18:43:58] it had no effect. The component still was its own parent [18:44:14] A component should never be its own parent; something's quite wrong there. [18:44:30] You must have an attribute that refers to self, that you're accessing. [18:44:51] create the object with the parent set, and you shouldn't have any of those issues. [18:45:11] * pje had forgotten just how complex all that stuff was [18:45:52] If all you need is contextual lookups like what the binding and config libraries do, you may be interested in the new "Contextual" library instead. [18:46:24] um... no idea [18:46:52] doc is at http://svn.eby-sarna.com/Contextual/context.txt?view=markup [18:46:55] yay, it works, thanks a lot [18:47:08] (well, you knew it works, but thanks anyway) [18:51:59] yes, you are right, this contextual stuff looks spot on [18:52:22] yeah, it's based on calling context rather than component hierarchy [18:52:42] well, I don't understand the complicated bits, really [18:53:55] Really, Contextual is all about "safe global variables" [18:54:09] it makes them thread-safe and task-safe [18:54:29] well, maybe mistakenly or not, all my config is private [18:54:38] maybe this is how I got into this mess [18:54:59] Well, Contextual lets you have module-private configuration that dynamically changes at runtime according to call context. [18:55:41] that call_with decorator is a bit terrifying :) [18:56:06] Yeah, that's part of why Contextual isn't released yet; it'll be much more useful with Python 2.5 [18:56:16] which has a 'with:' statement you can use instead [18:56:26] right yeah, I am seeing [18:57:06] So you can say "with some_variable(value): something_needing_config()" [18:57:26] This is most useful for stuff like web applications that need to shuttle a request context around. [18:57:37] oh yes, I see [18:58:13] The other bit is "resources" that are used in "actions", which is like 80% of what's done by PEAK's ServiceArea and Transaction stuff. [18:58:38] with context.Action(): do_stuff() [18:59:06] and voila, it's a transaction, but also a management facility for stuff like database connection pooling. [18:59:27] It's just the framework, though, I haven't got any of PEAK's actual transaction or db facilities hooked up to it as yet. [19:09:02] pje: I was wrng about it being the parent of itself, I was passing wrong things into the Compnent constructor [19:09:35] wrong things usually don't work well. :) [19:09:59] well, after a few hours you start commenting random bits out in hope.... oh well [19:49:12] ** pje has left IRC ("Client exiting")