[00:05:08] ** hazmat has joined us [04:02:33] [connected at Sun May 15 04:02:33 2005] [04:02:33] <> *** Looking up your hostname... [04:02:34] <> *** Checking ident [04:02:34] <> *** Found your hostname [04:03:04] <> *** No identd (auth) response [04:03:04] <> *** Your host is zelazny.freenode.net[zelazny.freenode.net/6667], running version dancer-ircd-1.0.35 [04:03:05] [I have joined #peak] [04:03:05] ** zelazny.freenode.net set the topic to http://dirtsimple.org/2005/04/generic-functions-reloaded.html [05:01:57] ** debugger has joined us [10:43:30] ** s1x has joined us [10:44:18] I am getting a class through a configuration key: key = importString('my.module:MyClass') [10:44:27] I want to binding.Make it [10:44:33] currently i'm doing: [10:45:01] MyClassFactory = binding.Obtain ("some.key") [10:45:17] MyClassFactory = binding.Obtain (PropertyName ("some.key")) [10:45:47] MyClass = binding.Make (lambda self: self.MyClassFactory (self)) [10:45:54] is there a prettier way to do it? [11:54:33] i've seen something about [Component Factories] in the bulletins example. Does it solves the "problem" I'm having? [12:29:44] ** pje has joined us [12:30:21] Yes, it does. If you specify a component factory for an interface, you can then use binding.Make(theInterface) [12:31:30] So if it's some_mdoule.IFoo, you do: [12:31:36] [Component Factories] [12:31:57] some_module.IFoo = "other_module.ClassImplementingIFoo" [12:32:31] And then 'myFoo = binding.Make(IFoo)' in the class will do the trick. [12:35:19] It also works for non-interface component keys, but the trick there is that you have to define the key in a module so it can be imported. [12:35:49] If you look at the bulletins example, it does this for BulletinDM, etc., using DMFor() config keys instead of interfaces. [12:36:25] Also, for a given configuration key, if you want all components in the same service area to share a common instance, you can use binding.Obtain(IFoo) instead of binding.Make(IFoo) [12:37:17] Any key with a component factory will have a default instance tied to the ServiceArea component (usually the config root), so if you Obtain it, it will be shared with others Obtaining it. [12:37:28] But you can still also have components that Make() their own. [12:37:36] ** pje has left IRC ("Client exiting") [12:52:47] ** debugger has left IRC () [12:58:18] ** [apoirier] has joined us [12:58:25] how can I define a key in a module? [15:12:34] ** pje has joined us [15:12:45] By saying someKey = expression [15:12:56] e.g. someKey = storage.DMFor(SomeModelClass) [15:13:06] someKey = PropertyName('some.property') [15:13:07] etc. [15:23:05] i see [15:23:17] lemme try it :) [15:34:31] nice, worked like a charm :) [15:49:24] <[apoirier]> hi pje [15:49:58] <[apoirier]> playing with PWT, I'am surprised how it seems to be tied to the web publication system [15:50:20] ** pje has left IRC (Read error: 60 (Operation timed out)) [15:52:33] [apoirier] is now known as apoirier [17:31:36] ** apoirier has left IRC ("Using KVIrc 3.0.1") [18:24:55] ** debugger has joined us [18:25:16] hi [18:30:06] hi [20:05:04] ** s1x has left IRC (Read error: 54 (Connection reset by peer)) [21:14:14] ** debugger has left IRC ()