[03:30:14] ** vlado_ has joined us [05:34:22] jack-e|away is now known as jack-e [05:57:49] morning [06:08:35] afternoon :) [06:09:48] ;-) [08:30:05] morning! [09:24:27] ** victorng has joined us [09:26:54] does anyone here have experience using the mdl_normalize class methods? [09:27:01] yup [09:27:24] what should i know about before i start implementing them? there's no comments about that method in the PEAK source [09:28:03] you don't have to write your own mdl_normalize method in many cases. [09:28:21] isn't it used as part of the validation system for objects? [09:28:48] yes .. but it redirects to the features referencedType's methods usually, except you have special cases. [09:29:00] e.g. if you specify a new NumberType [09:29:12] class NumberType(model.PrimitiveType): [09:29:23] like that OddNumber example is saw way back on the mailing list [09:29:33] yeo [09:29:56] i just finished skimming through the entire mailing list last weekend - all that binding renaming stuff threw me for a loop. :) [09:31:00] for the type you add a method e.g. mdl_fromString(str) to convert your data from string to NumberType [09:32:34] if you have special needs, you can overwrite the mdl_normalize of your type or element [09:32:40] err feature [09:32:47] what benefit does the mdl_features method have? i don't understand why i would really want to see all the feature objects. [09:33:03] on that note - is there a clear definition of the service-element-feature pattern? [09:33:20] it's always referenced, but i don't have a good grasp of how the pattern works [09:33:39] i work pretty much with these things: Model Driven Achitecture or Schema are the buzzwords that describe this technique [09:34:26] i haven't seen an uptodate SEF description .. in the old-days wiki of Transwarp (on old.zope.org in think) there was a description .. but it's horribly outdated [09:35:01] i use mdl_features to create forms/dm-configs etc from the model-spec [09:35:17] (it's comparable to zope3's schema) [09:36:11] right - that makes sense - so you can discover attributes that you want to modify. oh - right - so then you can use mdl_normalize to ensure that the objects get validated correctly. is that sort've along the right path? [09:36:53] for example i often write xml-parsers like that: [09:37:31] create a module with model-element classes (1:1 mapping to available XML-Element-Tags) [09:37:39] brb [09:37:46] * jack-e waits [09:38:41] ** victorng has joined us [09:39:16] a completely outdated description of SEF: http://zope.org/Members/pje/Wikis/TransWarp/ServicesElementsAndFeatures/view [09:39:21] * jack-e continues [09:39:28] for example i often write xml-parsers like that: [09:39:30] create a module with model-element classes (1:1 mapping to available XML-Element-Tags) [09:40:15] for each attribute of the tag the parser checks if the element has a feature with that name and uses the mdl_fromString method to convert the attributes str-value to a sensible value for the feature [09:40:26] that way your parser grows with your business-model [09:40:48] (without anymore changing, except enforcing certain structural aspects) [09:42:51] did this help a bit ? [09:42:55] ** vlado_ has joined us [09:46:17] ** vng1 has joined us [09:46:33] ** vng1 has left us [09:46:57] ** victorng has joined us [09:50:12] i'm going to have to re-read that sef document about 3 times to wrap my head around it. :) [09:50:56] did you use TransWarp in zope before? [09:51:34] nope .. but i started building my framework ontop of TW and am still refactoring it to use peak (mostly done though) [10:06:08] ** victorng has joined us [10:08:34] is there sample docs on how services are supposed to be implemented in PEAK? [10:08:51] there is no precondition to make a service [10:08:59] a service should implement some interface [10:09:50] then you make it available either a) through configuration (see peak.ini -> transaction service) or b) through binding it somewhere in your context with providing a sensible config-key (e.g. PropertyName, Interface, etc) [10:10:22] services are components .. that's the only precondition i know of .. [10:13:01] if you want to use a server you just xxx = binding.Obtain(storage.ITransactionService) for example [10:13:08] so where the TransWarp's services used aspects to combine services, PEAK uses the binding mechanism to accomplish the same thing? [10:13:42] basically yes .. most of TW's aspects aren't needed due to the flexible binding/config/naming stuff now available in peak [10:14:44] hey jack-e [10:14:51] maniac !! [10:15:14] is your legion of jabber-bots ready to fight ?? [10:15:18] :) [10:15:28] * Maniac saw victorng's weblog posting re:peak [10:19:09] bot = binding.Obtain(PropertyName('jabber.warbot')) [10:19:16] bot.attack('jack-e') [10:19:19] or something like that [10:19:40] self.lookupComponent(running.ITwistedReactor).crash() [10:19:47] :) [10:20:19] mm, never used self.lookupComponent [10:20:34] it's similar to naming.lookup(ctx, XXX) [10:20:58] except that lookupComponet does some search in the local's afaik [10:21:21] e.g. self.lookupComponent('myAttr') returns self.myAttr if existent [10:24:28] so you could do self.lookupComponent(PropertyName('blah')) [10:24:32] yup [10:24:42] to look up the property in context of self [10:25:36] * Maniac points jack-e to victorng's weblog: www.crankycoder.com [10:26:02] nice tld :) [10:26:13] he doesn't seem cranky though [10:26:21] haha [10:26:29] i'm less cranky these days -i used to program java. :) [10:26:35] hehe [10:27:01] if you look around there jack-e you'll find pictures of victorng at a haloween costume party, and that's just scary :) [10:27:19] i'm a very ugly blonde woman. [10:27:27] :) [10:27:29] http://homepage.mac.com/vng1/PhotoAlbum25.html [10:27:50] * Maniac never posts pictures on the intarweb [10:28:45] that's great - when people go looking for PEAK info - they'll find scary pictures of drag queen cub scouts. [10:28:49] * jack-e 's private life is exposed at many sites at least once a month after our club-event (www.fet.org, www.hr-foto.de) [10:29:12] ah, jack-e and his wild weekend night life [10:29:52] not allways: http://techno-deluxe.de/team-couch/html/images/vorsprung-durch-techno.jpg [10:30:14] sometimes we're on the road (with our boards) during daytime as well ;-) [10:30:31] so which one are you? [10:30:35] the cute girl? [10:30:38] upper right corner [10:30:57] mr unshaven? [10:31:01] that's not the cute girl [10:31:02] yep :) [10:32:37] you look too cool to be a programmer :) [10:32:55] .. [10:32:56] * Maniac is decidedly wasting serious work time checking out fet.org [10:33:41] you need to listen to the sounds/videos .. more than 120 hrs are online i think (since 1998) [10:34:45] i see mp3's there [10:34:53] yes .. lot's of [10:35:05] all live recordings from our club-events [10:35:11] 2-8hrs each [10:35:38] do you have a 'blog' or weblog? [10:36:08] i tried to start a weblog .. but i think i'm to lazy .. [10:36:37] that's why i'm a coder .. write programms that do my work ... [10:36:59] but till now it was more work .. but at leas fun :-) [10:43:40] till now? [10:44:09] more work writing programs that do my work, instead of doing it directly without the help of a computer ;-) [10:57:58] * Maniac notices that victorng left [10:58:07] bye vic! [10:58:50] ** vlado has joined us [11:06:42] * jack-e thinks that an: from peak.api import * should only import the core apis (binding, config, naming, protocols) + some convinience things like PropertyName, Items .. but not storage, net, etc [11:32:48] * Maniac has no opinion [11:32:59] they are lazy imports aren't they? [11:33:04] i know i've been scoffed at for using from x import * [11:33:33] yes .. but they flood your namespace .. [11:33:56] if there come additional packages (query, etc) it'll be worse [11:35:32] and pje clearly stated the core-apis vs. framework-apis in one of his latest mails .. i think that would be a good diversion [11:35:42] if you need peak.model you still can [11:35:54] from peak.api import model, storage to be able to use DM's and Elements [11:36:30] another possiblity would be: [11:36:34] from peak.coreapi import * [11:36:49] or somethin similar [12:09:00] ** victorng_ has joined us [12:09:14] stupid irc client logged me out without telling me. bah. [12:09:41] can someone clarify the usage of referencedType and referenceEnd? If I specify something like class foo(model.Attribute): referencedType = model.Integer -- what does it buy me? I seem to be able to still assign strings to foo. I have absolutely no idea what referenceEnd does. [12:10:56] the validation-framework as you stated earlier is still vaporware [12:11:29] so the types as they're used now are mostly for declarative purposes and automated valueconversion done by your app directly not yet the framework [12:11:34] i think that coreapi idea is a good one - there's a whole lot of stuff that gets put into the namespace. [12:12:04] the referencedEnd enables you to define Associations between model.Elements [12:12:19] look at the bulletings example's Category/Bulletin [12:12:51] relations between tables in RDBMS land [12:12:55] in Bulletin you have a category w/referencedEnd bulettins and a bulettin w/referencedEnd category [12:13:15] Maniac: not limited to that [12:13:24] it's just relations between objects [12:13:31] yes, not limited to but and example of no? [12:14:04] yup [12:14:39] you could e.g. category.addBulletin() and the .category will automagically be set to [12:15:20] when you .deleteBulletin() the association is deleted again [12:15:27] (on both sides) [12:19:05] i'm confused - by specifying the referencedEnd - this is a hint to create a 1 to many relationship to another object? does this work right now or is it something coming in the future? [12:19:30] it works on the python-level but has to be handled in the storage backend explicitly [12:19:52] object <-> object relations 1:n, n:m [12:20:05] aha! cool - i made a typo in the interpreter which is why my little test didn't work. [12:28:41] victorng_: what project do you want to use peak for ?? [12:33:27] i'm giving myself about 2 weeks to evaluate PEAK to build a travel reservation system [12:33:53] what timeline do you have for development/production ?? [12:34:04] quite a long time - 12 months [12:34:12] ok .. sounds good [12:34:22] i'm crazy - not that crazy though. :) [12:34:34] hehe .. what Userinterface will it have (if any) [12:34:51] haha - yes - that would be a piece that scaring me right now [12:35:09] * jack-e is working on a component-wrapper for wxPython and peak [12:35:35] i'm thinking web app - mainly there's a deployment issue where i've got a mixed desktop enviroment (some OSX machines, some Windows, some Mac OS9 machines) [12:36:04] i've played with wxPython a little - the rendering is really botched under OSX [12:36:28] right .. they're at the very beginning of OSX support i think [12:36:53] yes - basic text views break when you scroll up and down [12:36:59] outsch [12:37:10] it's pretty bad [12:38:09] i haven't been on IRC in about 7 years - how do you send those msgs that don't look like 'normal' irc messages? [12:38:29] add "/me" before you type [12:38:51] * victorng_ scratching his belly [12:38:59] yay [12:39:22] 7 years is a long time .. [12:39:49] haven't been on since university [12:39:55] oh the glory days of undernet [12:41:55] the things i need out of PEAK (or something else) are individually simple -- configuration management, logging, a stackable persistence layer to manage caching, and preferably some tools to help me model the domain -- iotw i basically need PEAK. [12:43:02] except for the storage-api .. the modules are fairly stable i think .. the storage module will be refactored sometime in the (near) future afaik [12:43:12] (stable: config, binding, naming) [12:43:16] + protocols [12:43:27] (without guarantee) [12:43:35] right - i saw a mention about relvars? [12:43:55] and the DMs getting refactored? oh - any idea how the lazyload for the DM works? [12:43:59] pje is working on a query-framework [12:44:10] yes :) [12:44:14] and yes [12:44:30] jack-e if you're ever in Toronto - i'll have to get you a pint of beer [12:44:43] i've been in toronto [12:44:50] (about 11 years ago) [12:45:01] stopover to get to Regina - visitin my Ant [12:46:01] the lazyloading works mostly by using persistence-baseclass of zodb4 (load object's state when first attribute is accessed) [12:46:05] forget toronto visit winnipeg, much closer to regina [12:46:10] hehe [12:46:58] to be more precise: humboldt .. a small town that ***tries*** to be little germany [12:47:34] Maniac: ur from canada too ? [12:51:08] winnipeg? the folk festival town? [12:53:16] jack-e is there an example for using the lazyload mechanism in the datamanagers? [12:53:33] datamanager encapsulate this behaviour by default [12:53:55] if you implement _load/_save/_new + use model.Element objects .. your basically done [12:54:46] at some points you'll need to use QueryLinks to get 1:n/n:m relations done with lazyloading + if you have BLOB's or similar there are some tricks as well [12:55:13] i have done quite a lot .. but most of my stuff ist not yet updated to the latest binding API which might confuse more than it helps [12:55:30] (cvs.net-labs.de --> apps and libs ) is all of my work done with peak [12:56:28] hold on - so in bulletins.storage.BulletinDM - the category attribute is lazy loaded from the CategoryDM? [12:56:49] .category you mean =? [12:57:08] if you do a [oid] you get back a GHOST object [12:57:38] if you first access an attribute of this GHOST object it mutates to a real model.Element with the right instance-data [13:01:22] so at the time i access the attribute - the data is loaded - that must mean i need to handle object versioning within my custom DM then right? [13:01:42] if you have object-versioning .. yes :) [13:02:01] well otherwise you'd get the possibility of having lost updates wouldn't you? [13:02:16] what do you mean by that ? [13:02:44] all changes happen in a transaction necessarily [13:02:44] the exact case is that i've got trips that we sell - each trip has a certain number of available spaces on the trip. [13:04:11] so i just need to register my object as transaction participants, hook into that voting mechanism and i should be safe? (that's sort've the next task i was going to do today) [13:04:50] if you use a DM you need to do a storage.begin() [13:05:08] then you can query, modify your objects as you like .. nothin will happen in the storage-backend [13:05:17] till you do a storage.commit() [13:05:39] or storage.abort(..) to abort [13:05:53] ( your backend needs to support transaction )= [13:11:01] ok - so in the case of mutliple threads coming in at the same time - do i just use a common context for the transaction service? that should throw a TransactionInProgress exception right? [13:11:58] hmm .. if concurrency is handled 100% i don't now .. [13:13:04] if you have concurrent requests, pje would probably suggest to build an app-server that invoke one complete app per thread and let concurrency be handled in the RDBMS with locking .. but don't beat me if i'm wrong [13:13:30] each app would then handle only one request at a time [13:14:01] (but i'm still doing research on this part for my projects as well) [13:14:07] the case i'm thinking of is i've got 1 spot left on a trip. 2 people come in to book the last spot at the same time. i think i need to do change the state twice. [13:14:54] the request, that locks the row first will win, the other loose .. if you only have one place .. you cannot sell it twice .. [13:15:55] is it online-booking or is the communication delayed [13:15:55] ? [13:16:26] all of the transactions should be live - so it's onlnie booking [13:17:10] so i think i should just do a "select for update" in my DM when i write back to the database [13:17:10] so the request that came first will get a confirmation-id the other should get a SorryTooLateException ;-P [13:17:55] yes - i'd like to get a confirmation-id and a nice pretty error message (wouldn't we all like that?) :) [13:18:21] that depends on your implementation and design .. [13:19:25] what would you see as the downside of doing select for update? [13:19:40] the common case is many readers, few updates [13:19:57] * jack-e is not a RDBMS-geek .. pje's the one to ask i think [13:20:35] * victorng_ tries not to be a RDBMS geek. Got burned by Oracle and shared global memory, rollback segments and other nastiness last year... [13:20:43] hehe [13:20:52] * victorng_ having horrible flashbacks of Oracle tuning [13:21:10] i know basically what you mean by "select for update" but i cannot give any advise [13:21:29] ok - well i gotta get lunch. isn't it late in germany? [13:21:42] half to eight in the evening [13:22:07] well - thanks for all your help - it's really appreciated. [13:22:08] ttyl [13:22:21] we're migrating our AFS-Cell currently (backup -> ssh-pipe -> restore) to a new server [13:22:41] so we need to stay here to watch if something goes wrong .. [13:23:06] cu .. and you're welcome [13:23:15] ahh. i remember having to stay awake all night for Deutsche Telekom. :) [13:23:23] :) [13:23:27] see ya [13:27:05] ** als has joined us [13:58:34] yes I AM CANADIAN! [13:58:58] (obscure reference to a canadian beer commercial) [14:00:16] and where is winnipeg located (saskatchewan as well ?) the name sounds familiar .. but i cannot remember where to put it .. [14:03:35] no, Manitoba, right beside saskatchewan (about 4 hours away from border I think 6 or so hours from regina) [14:04:26] ahh .. ok .. humbold is about an hour drive in the north of regina .. we traveled by car from regina to vancouver then to visit some other people from our family .. [14:04:35] it was a really nice vacation .. [14:04:59] i drove up north to visit some big lakes and national-parks by my own .. [14:05:39] * jack-e is off for dinner [14:05:46] there are some really nice parks around here [16:46:52] ** vlado has joined us [17:04:42] * vlado is away, somewhere far beyond... (l!on)(p!off) [cRk/bx] [17:29:39] * Maniac wonders if pje is going to announce pyprotocols 0.9.1 on peak mailing list... [17:32:15] hmm .. it's actually available at www.python.org/pypi .. [17:56:36] yes, but he announced on zope3-dev, twisted-python, and another i think, but not peak :) [17:57:04] * Maniac notes now his irc client is proxied via irssi so he doesn't have to log in 1 @ home and 1 @ work [17:59:18] he probably assumes that we already know it :-) [18:27:11] here burn some time competing with me: [18:27:11] http://hannu.daug.net/letters/index.php [18:27:29] i got like 300 [18:39:45] hmm still running and got 2300 [18:39:56] i stopped at 2227 [18:40:56] (maybe my X-Terminal is to slow for that game :-) [18:42:06] and it seems that they post the highscores at some non-http-port (my firewall doesn't let it through) [19:48:32] ** vlado has joined us [20:14:49] jack-e is now known as jack-e|away [20:43:03] * vlado is away, somewhere far beyond... (l!on)(p!off) [cRk/bx] [21:09:30] how the heck did you get 2300!!!????!!!! [21:09:32] i SUCK!