[04:02:47] [connected at Tue Aug 16 04:02:47 2005] [04:02:47] <> *** Looking up your hostname... [04:02:47] <> *** Checking ident [04:02:47] <> *** Found your hostname [04:03:19] <> *** No identd (auth) response [04:03:19] <> *** Your host is calvino.freenode.net[calvino.freenode.net/6667], running version hyperion-1.0rc5 [04:03:19] [I have joined #peak] [10:51:11] I cannot figure out the config system. There is no documentation. [10:55:41] ** pythonhead has joined us [10:58:50] Never mind; I figured it out. :-P [11:08:15] Well, actually, I just got it /working/. I still don't know why it, which uses the same strategy as the bulletins example, works. [11:45:23] ** pje has joined us [11:47:41] Ah, pje! When you have a moment, could you enlighten me regarding the config system? [11:47:57] * pje waves a magic wand at erikrose [11:47:59] Presto! [11:48:06] I am enlightened! :-D [11:48:06] You're now enlightened. :) [11:48:29] I feel much better, but my code still works, and I don't know why. ;-) [11:48:46] I'm trying to figure out why the bulletins example works: [11:49:08] It does something like this in its config file: [11:49:08] [Component Factories] [11:49:08] modeldemo.model.PersonDM = "modeldemo.storage.PersonDM" [11:49:23] And then something like this in its model.py: [11:49:29] PersonDM = storage.DMFor(Person) [11:49:37] But I can't figure out how those interact. [11:50:09] The name on the left of the = is an import [11:50:14] Right. [11:50:38] Component Factories then registers a FactoryFor(whatItImported) [11:50:53] Which then is used by the service area to invoke the factory. [11:51:05] (factory being the thing on the right of the =) [11:51:20] So in this case, it being just another import string, it just resolves the symbol? [11:51:34] resolves the include path, that is? [11:51:57] Gah, import, rather? [11:52:05] Yep. [11:52:10] Ooookay. [11:52:20] Laziness is the key to configuration. :) [11:52:24] But then there's this "PersonDM = storage.DMFor(Person)" floating around in model.py. [11:52:32] Yeah, that's a kludge. :) [11:52:39] Ahhhh. [11:52:53] DMFor returns a config key, whatever that is, [11:52:59] What should probably really happen is that entity classes should grow a 'DMKey' or something like that. [11:53:21] so that it could be modeldemo.model.Person.DMKey or some such. [11:53:32] That would be good. [11:53:52] I just did that in bulletins at the time as a quick fix to get rid of the IoC parent class. [11:54:05] How does the kludge work? [11:54:21] I'm saying the kludge is that I set PersonDM = storage.DMFor(Person) [11:54:36] Because Component Factories has to import something on the left side [11:54:42] I would expect one of {the component factory, PersonDM = storage.DMFor(Person)} to overwrite the other, but that clearly isn't what happens. [11:55:06] So does it matter what you set PersonDM to? [11:55:12] Of course, another option would have been to create a [Data Managers] section handler [11:55:26] Yes, it does. [11:55:34] It needs to be a configuration key [11:55:46] The point of Component Factories is that it imports a key on the left, and a value on the right. [11:56:03] *tentative light bulb* [11:56:25] So when somebody looks up storage.DMFor(Person) (the key), they get the value (the factory) [11:56:32] So it's not assigning something to the "modeldemo.model.PersonDM" symbol. [11:56:43] Component Factories? No. [11:56:54] Ah. That's what I thought it was doing, due to syntax. [11:56:57] The lvalue is just the key it registers the rvalue under [11:57:17] Wow. That makes sense now. [11:57:39] "=" in .ini should generally be read as "the value for this key is" [11:57:47] Mmmmmmmmmm. [11:58:17] However, not all sections import their left-hand-side; in fact most don't. [11:58:40] Mmmkay. [11:59:02] My other question was this: if I do this a bunch of times... [11:59:03] I think Component Factories is the only one that imports the left hand side and uses the resulting value as the key [11:59:13] something = binding.Obtain(storage.DMFor(Person)) [11:59:15] Most everything else just uses the left hand side as a string [11:59:29] ...I should get the same PersonDM instance each time, no? [11:59:55] (Yes, I did actually get a Named Service working, and there was much rejoicing.) [11:59:57] if the components doing it are all in the same service area, or share a common parent publishing storage.DMFor(Person), yes. [12:00:24] They all have the same root. [12:01:08] Then hopefully something is not right with my code, because the DM's are making too many queries to the DB, queries they shouldn't be making because they should be cached in the DM already. [12:01:10] The point of Obtain() *is* to share a value or component. [12:01:13] Right. [12:01:18] Otherwise, you'd be Make()-ing your own. :) [12:01:23] Right right. [12:01:48] Can't you tell how many connections are active? That'd tell you pretty quick if you have more DM's than you expect. [12:02:02] Well, in any case, they'd share the same ISQLConnection. [12:02:12] Oh right, never mind. [12:02:16] And I confirm that Postgres is only hearing 1 connection throughout the runtime of the app. [12:02:20] That would be a different bug. :) [12:02:28] Right. :-) I'd notice that one pretty quickly. [12:02:37] (that has bitten some people before, i.e. they didn't get their DMs sharing the connection) [12:02:52] Yeah, I read the thread on the TableDM, iirc. [12:03:07] Er, no, it was the psycopg pooling thread. [12:03:55] Mmm, actually, I am closing and reopening the connection in my app. That's probably it. [12:04:11] (It's just a bunch of test routines, each doing its own txn.) [12:04:36] However, my SQLQueryDM is executing its select * query more than once, which is hopefully my fault. [12:05:11] Say, is there any config system documentation I'm missing, apart from IntroToPeak, your old PDF, and the docstrings? [12:10:45] Um, probably not. [12:10:57] Btw, your query DM is going to purge its cache between txns [12:11:03] As expected. [12:11:08] Unless you configure it not to. [12:11:18] No, it definitely ought to. :-) [12:11:25] ok [12:11:58] It looks like my SQLQueryDM isn't caching at all, for some reason. That'd explain it all. [12:12:08] *debugging sounds* [12:39:56] ** pje_ has joined us [12:55:18] ** pje has left IRC (Read error: 110 (Connection timed out)) [13:01:26] ** sprout has joined us [14:26:18] ** _erikrose has joined us [14:43:55] ** erikrose has left IRC (Read error: 110 (Connection timed out)) [15:09:06] ** erikrose has joined us [15:26:31] ** _erikrose has left IRC (Read error: 110 (Connection timed out)) [19:43:32] ** pje_ has left IRC ("Client exiting") [21:35:56] ** sprout has left IRC ("Snak 5.0 IRC For Mac - http://www.snak.com") [23:11:06] ** oubiwann has joined us