IRC log of #zope3-dev for Friday, 2005-03-11

*** SureshZ has joined #zope3-dev00:09
*** projekt01 has quit IRC00:09
*** projekt01 has joined #zope3-dev00:09
*** hazmat has quit IRC00:16
*** mohsenX has quit IRC00:24
*** Aiste has quit IRC00:25
*** SteveA__ has joined #zope3-dev00:30
*** SteveA has quit IRC00:36
*** projekt01 has quit IRC00:44
*** watzo has quit IRC01:07
*** Aiste has joined #zope3-dev01:10
*** J1m|away has quit IRC01:12
*** hazmat has joined #zope3-dev01:14
*** niemeyer has quit IRC01:22
*** tarek_ has joined #zope3-dev01:25
*** hazmat has quit IRC01:34
*** SureshZ has quit IRC01:48
*** Aiste has quit IRC01:51
*** BjornT has quit IRC02:14
*** BjornT has joined #zope3-dev02:14
*** stub has joined #zope3-dev02:16
*** BjornT has quit IRC02:26
*** hazmat has joined #zope3-dev02:35
*** tarek_ has quit IRC02:37
*** hazmat has quit IRC03:07
*** BjornT has joined #zope3-dev03:11
*** hazmat has joined #zope3-dev03:26
*** jdz_ has joined #zope3-dev03:46
*** hazmat has left #zope3-dev04:12
*** jdz_ has quit IRC04:18
*** alga has quit IRC05:37
*** viyyer has joined #zope3-dev07:02
*** `anthony has quit IRC07:14
*** `anthony has joined #zope3-dev07:26
*** BjornT has quit IRC08:02
*** d2m has quit IRC08:02
*** d2m has joined #zope3-dev08:18
*** zagy has joined #zope3-dev08:26
*** hdima has joined #zope3-dev09:20
*** `anthony has quit IRC09:25
*** zagy has quit IRC09:30
*** sashav has joined #zope3-dev10:10
*** watzo has joined #zope3-dev10:39
*** projekt01 has joined #zope3-dev10:39
*** ignas|away has quit IRC10:53
*** d2m has quit IRC11:00
*** zagy has joined #zope3-dev11:03
*** Aiste has joined #zope3-dev11:07
*** MrTopf has joined #zope3-dev11:11
projekt01Good morning11:28
*** stub has quit IRC11:34
*** SteveA__ is now known as SteveA12:00
*** __gotcha has joined #zope3-dev12:20
*** d2m has joined #zope3-dev12:29
*** d2m has quit IRC13:02
*** d2m has joined #zope3-dev13:13
*** __gotcha has quit IRC13:38
*** MalcolmC has joined #zope3-dev13:43
*** bskahan has quit IRC14:19
*** tav|offline has quit IRC14:19
*** bskahan has joined #zope3-dev14:19
*** tav|offline has joined #zope3-dev14:19
*** tav|offline has quit IRC14:20
*** tav|offline has joined #zope3-dev14:20
*** faassen has joined #zope3-dev14:21
*** __gotcha has joined #zope3-dev14:25
*** srichter has quit IRC14:26
*** niemeyer has joined #zope3-dev14:31
*** povbot has joined #zope3-dev14:47
*** andrew_m has joined #zope3-dev14:50
*** SureshZ has joined #zope3-dev14:54
*** viyyer has quit IRC15:03
*** tav|offline has quit IRC15:03
*** bskahan has quit IRC15:03
*** tav|offline has joined #zope3-dev15:04
*** bskahan has joined #zope3-dev15:04
*** tav|offl1ne has joined #zope3-dev15:05
*** tav|offline has quit IRC15:05
*** srichter has joined #zope3-dev15:09
*** ChanServ sets mode: +o srichter15:10
*** bskahan has quit IRC15:30
*** bskahan has joined #zope3-dev15:31
*** BjornT has joined #zope3-dev15:40
*** bskahan has quit IRC15:46
*** bskahan has joined #zope3-dev15:46
*** MalcolmC has quit IRC15:52
*** bskahan has quit IRC15:53
*** bskahan has joined #zope3-dev15:57
*** tarek_ has joined #zope3-dev16:10
*** MalcolmC has joined #zope3-dev16:10
*** bradb has quit IRC16:15
*** SureshZ has quit IRC16:22
*** BjornT has quit IRC16:22
*** bradb has joined #zope3-dev16:34
*** SteveA_ has joined #zope3-dev16:38
*** SteveA_ has quit IRC16:42
*** BjornT has joined #zope3-dev16:42
*** Ragica has quit IRC16:43
*** SteveA_ has joined #zope3-dev16:45
*** hdima has quit IRC16:47
*** SteveA has quit IRC16:47
*** J1m has joined #zope3-dev16:48
*** Ragica has joined #zope3-dev16:49
SteveA_hi J1m17:00
*** SteveA_ is now known as SteveA17:00
SteveAare you still good to talk about pre-render hooks on views?17:01
*** GaryPoster has joined #zope3-dev17:02
J1mHoping Gary will join us17:02
J1mThere he is17:02
SteveAhi gary17:02
GaryPosterhi Steve17:02
SteveAI've had two interesting problems recently.  I'm hoping to address at least one of them here.17:02
J1mMy grand design is to have something like CMFFormController for Zope 3.17:02
SteveAmaybe i can start by briefly describing the problems?17:02
J1mMy related grand design is to split actual rendering/publishing into multiple steps.17:03
J1mSure, go ahead17:03
* J1m unfortunately, has very little time these days to work on grand designs. :)17:04
SteveAthanks.  the first is, i want to have some code run before a Page gets rendered.  often, this is stuff that processes a form's response.17:04
SteveAbut sometimes, it is set-up code for the page template.17:04
SteveAi don't want to do either in the __init__, as this causes various problems17:05
SteveAlike heavy processing occuring by just asking for a view.17:05
SteveAthe second is, i want to mark a content object with certain marker interfaces, depending on the object's state, and also on the request or the interaction.17:06
SteveAi need to do this before views are looked up.17:06
SteveAbut, i don't want to do that when objects are loaded, because the marker interfaces to use depends on presentation things.17:06
SteveAthat is, the marker interface to use is not intrinsic to the state of the object.17:06
* SteveA is done17:06
GaryPosterso, these markers are temporary, only for the request?17:07
SteveA(i'm on a laggy connection, so please bear with me if i seem slow to respond sometimes)17:07
J1mThis (2nd) feels very weird to me17:08
GaryPosterAlso, marius suggested __call__ rather than __init__; what are its drawbacks for your purposes (the first use case you raised)17:08
SteveAJ1m: yes.  i didn't come up with it.  i'm currently looking at whether to keep it, or to do something different.17:08
SteveAJ1m: so, i'm not bothered if we skip the 2nd case.17:08
J1mCool :)17:08
J1mI'd be happy to discuss the motivation for the 2nd case a little later.17:09
SteveAGaryPoster: do you mean calling __call__ on a view's class if it is present, before rendering a view's page?17:10
J1mThings brings us to a related topic. :)17:11
J1mWe currently don't have a defined interface for published objects.17:11
J1mThe informal interface is that published objects are called (via mapply)17:12
J1mI want to change this for X3.2.17:12
J1mSo anyway, publish objects are called.17:12
GaryPosterMaybe I'm remembering incorrectly, but I thought the API for rendering a a view class was __call__; this usually renders the template but a view class could step in front and do preprocessing...but Jim is addressing this... :-)17:12
J1mThe current page and form machinery arrange that __call__ is a call to the template.17:12
J1mBut, of course, we could do something else.17:13
SteveAhow does __call__ say "now render the template" ?17:13
J1mThe __call__ of most views (produced by page or forms) just calles the template.17:14
J1mThe __call__ of most views (produced by page or forms) just calls the template.17:14
SteveAso, if i override __call__, how do i say "now render the template" ?17:14
J1mI couldn't tell you off had.17:15
J1mI could look it up.17:15
J1mIt *might* be the same accross different mechanisms (pages, and forms), but it might not, as it's not currently part of the api.17:16
J1mWe could arrange that the template has a well-defined name, so you could override __call__ and call it.17:16
SteveAi like the idea of explicitly saying "now render the page" from an explicit __call__, as that would allow you to not render the page if for example you're doing a redirect.17:17
J1mSure, or rendering a different page.17:17
J1mSo, perhaps the easiest way to do this is by overriding call?17:18
J1m(At least in the short term.)17:18
GaryPosterIt feels nice and simple to me.17:18
J1mAnd we arrange that the template is exposed with a well-known name?17:18
J1mme too.17:18
SteveAthat would solve both my first cases, provided there's a clear way to say "render the page"17:18
J1mLeaves room for grander plans in 3.2. :)17:19
J1mIt addresses all 5 of my first cases. ;)17:19
GaryPosterI like that too.  The render the page would be i.e. self.template()17:19
GaryPoster(return that :-) )17:20
SteveAso, how will a __call__ method look, that sets up some state for the template to use?17:20
SteveA  def __call__(self):17:20
SteveA      self.set_up_the_state()17:20
J1mI think the default __call__ is:17:20
SteveA      ???17:20
J1mdef __call__(self):17:20
J1m    self.template()17:20
GaryPosterreturn self.template()17:20
J1mAnything else is up to you.17:20
GaryPosterSo you might have a mixin view class that was17:21
GaryPosterdef __call__(self):17:21
SteveAso, i could grab the output of self.template() and do stuff to it17:21
SteveAbefore returning it17:21
GaryPoster    # do your set up, setting attributes on the view and possibly sending things to the options of the template call17:21
GaryPosterand then the return self.template(*maybe_you_have_options)17:22
SteveAwhat kind of object is self.template() ?17:22
SteveAwhat kind of object is self.template ?17:23
J1mA ViewPageTemplateFile.17:23
*** stub has quit IRC17:23
SteveAself.template() is string data.  (as in, str, pretending to be binary data)17:23
GaryPosterself.template: page template; self.template(): unicode17:23
SteveAI don't think you can pass options to a ViewPageTemplateFile17:23
J1mYes, you can17:23
J1mI'm 90% sure you can17:23
SteveAdo I return unicode or str from __call__ ?17:23
J1mas keyword arguments17:24
GaryPosterI know I've done this sort of thing :-)17:24
J1municode (or it's a bug)17:24
J1mThe encoding is done by the publisher.17:24
SteveAso, if __call__ wants to return image data, it uses response.setBody() ?17:24
J1mI don't know off hand. Look at image objects. :)17:25
GaryPoster(I don't know; I'd look at the Image implementation)17:25
projekt01I think call self.template() will process the page template, right?17:26
SteveAFileView has a show() method17:27
SteveAthat returns after setting the content-type and content-length headers17:27
J1mThat method is probably listed as an attribute in the zcml.17:27
SteveAit is hooked up with a browser:page that uses a class and attribute17:27
SteveAso, using a class+attribute means you return str data.  using a class+template means you return unicode.17:28
*** benji_york has joined #zope3-dev17:28
SteveAif that's right, that seems rather implicit17:29
J1mKeep in mind that we don't have a formal publishing interface.17:29
J1myes, it is17:29
* SteveA invokes the "i" word17:29
J1mGo ahead17:29
SteveAi never consciously realized it17:29
GaryPoster(uh-oh :-) )17:29
J1mSure you did.17:29
J1mYou objected to having views provide Interface.17:29
J1mYou want us to provide something more specific.17:30
J1mI do too.17:30
J1mI'm afraid I don't have time now to work out what that should be.17:30
SteveAoh that, sure.  what i didn't realize was that the publisher expects class+attribute to return something different from class+template17:30
J1m(Plus we need to stop adding features for 3.1.)17:30
J1mThe publisher expects calling the objects to return something.17:31
J1mWhat that something is is undefined.17:31
J1mIt's up to the response to make sense of it.17:31
SteveAso, if class+attribute returns a unicode, then the publisher will encode it17:31
J1mFor example, XML-RPC responses expect possibly complex data structures to be returned.17:31
J1mYes (I suppose)17:32
SteveAand if it returns an unencoded str (that is, data), then it assume it is ready-encoded17:32
* SteveA needs to read the code17:32
SteveAbut, for 3.2, this will be explicit, because there will be an interface for this.17:32
J1mOr perhaps it takes the content type into account17:32
SteveAok, great.17:33
J1mThere are *many* goals in play here.17:33
SteveAthis all gives me enough to work with for now17:33
SteveAand get rid of <tal:dummy replace="view/method_to_set_stuff_up_that_returns_empty_string" />17:33
J1mI was hoping to work this out via the Bobo project I haven't had time to work on. Sigh.17:33
J1mYup. Us too.17:34
*** MrTopf has quit IRC17:34
SteveAcool.  thanks J1m and GaryPoster.17:34
J1mSo, now we need someone to implement what we talked about. :)17:34
J1mAny volunteers?17:34
GaryPoster:-) Good to hear from you SteveA17:34
SteveAwhat's there to implement?17:34
* J1m cups his hand by his ear17:34
SteveAan interface for views' classes?17:35
J1mA template attribute define by the page and form directives17:35
J1mMaking sure that people can override __call__ the way we described.17:35
SteveAokay, put me on the hook for that17:36
GaryPosterJim is looking at me like I want to volunteer, maybe17:36
GaryPosterok, cool17:36
J1mCool Steve17:37
SteveAdo you have time to talk about the 2nd issue i mentioned?17:39
SteveAso, in this system, objects are not cached between requests17:39
SteveAthere are different views on an IReadOnlyFoo and an IEditableFoo.  Both interfaces extend IFoo.17:40
SteveAcurrently, the system that loads objects considers the state of a Foo that is being loaded, and the logged-in user, and marks the Foo with either IReadOnlyFoo or IEditableFoo17:41
SteveAmy main complaint about this currently is that content code is taking the interaction into account when setting interfaces on content objects.17:42
SteveAi can fix that by using events, and having an event handler that activates on on loading a Foo, that is registered from "presentation" space.17:42
SteveAbut, i'm dubious about the whole notion of temporarily marking objects like that, taking into account the interaction17:43
SteveAi'm quite happy with marking objects taking into account only their own universal state17:43
SteveAone thing i could do is to decorate the Foo object with a temporary decorator, before it gets to be published17:46
SteveAthe decorator can be editable or read-only17:46
GaryPosterwhat sort of presentation decisions do you need to make?17:46
* J1m doesn't want to interrupt17:46
GaryPoster(Gary interrupted happily :-) )17:47
* SteveA had finished, but forgot to say17:50
J1mI agree with your assessment.17:50
J1mI'm wondering what the motivation for this is.17:51
J1mIs it to provide different UI depending on the priviledges of the user?17:51
J1mOf course, we do this now by electing different views depending on priviledges.17:53
J1mOf course, we do this now by selecting different views depending on priviledges.17:53
SteveAi don't follow17:53
J1m@@selectedManagementView picks the first view for them that they can see17:54
J1mWe only show links to views they can see.17:54
SteveAoh, right, in the zmi17:54
J1m(The former then uses a redirect.)17:55
SteveAso, one principle i should consider is that if the presentation for read-only and for edit is radically different enough to want a different page implementation, than maybe it wants a different URL too17:56
J1mWhat you really have is a relationship between 2 objects.17:56
J1mYou have a relationship between an object and an interaction.17:57
J1mYou want to choose the view based on that relationship.17:57
J1mYour decorator idea sort of captures that.17:57
SteveAi see18:00
SteveAyeah, the decorator could be considered a view itself.18:00
SteveAit depends on IFoo and the interaction18:00
SteveAand provides IFoo18:00
SteveAdecorated with something else that extends IFoo18:01
SteveAthanks jim.  that gives me a bunch of stuff to think about.18:02
J1mIt could be argues that this is a case where Eby's predicate dispatching would be useful.18:02
J1mYou want to select view X if the type is T and you have permission P.18:02
J1mYou want to select view Y if the type is T and you don't have permission P.18:02
* SteveA doesn't see it yet18:03
* SteveA was lagged18:04
* J1m just BSing ;)18:04
J1mYou could register a factory that selects another factory based in access rights18:04
SteveAthat's an interesting idea18:05
J1mYou could register a factory that selects another factory based on access rights18:05
SteveAfor example, i could have a kind of view that is selected not on (context, request, name) but (context, request, name, permission)18:05
J1mThis would be a combination of type-based dispatching and predicate-based dispatching.18:05
SteveAwhere permission isn't really part of the tuple, but is actually a predicate18:06
J1mI'm not suggesting this, just thinking out loud.18:06
SteveAi already have some decent support for decorators18:07
J1mWhat I like about this is that it seems concpetually cleaner than interaction-based interface hacks or even decorators.18:07
SteveAso i'll consider that one first18:07
J1mOK, I need to get back to work.18:07
*** J1m is now known as J1m|away18:07
SteveAi could easily add a one-off view that dispatches to one of several other views based on permissions18:07
SteveAso, if it is a one-off, then i can do that18:07
SteveAthanks again.  plently of options now.18:08
*** vlado has joined #zope3-dev18:11
*** bskahan has quit IRC18:35
*** bskahan has joined #zope3-dev18:45
*** Aiste has quit IRC18:45
*** sashav has quit IRC18:46
*** apoirier has joined #zope3-dev18:52
*** vlado has quit IRC18:57
*** vlado has joined #zope3-dev19:02
*** Theuni has quit IRC19:12
*** Aiste has joined #zope3-dev19:16
*** vlado has quit IRC19:20
*** MalcolmC has quit IRC19:38
*** bskahan has quit IRC20:04
*** bskahan has joined #zope3-dev20:15
*** alga has joined #zope3-dev20:37
*** alga_ has joined #zope3-dev20:40
*** alga_ has quit IRC20:43
*** ignas_ is now known as ignas20:53
*** apoirier has quit IRC21:01
*** alga has quit IRC21:06
*** faassen has left #zope3-dev21:18
*** bskahan has quit IRC21:23
*** tvon has quit IRC21:28
*** bskahan has joined #zope3-dev21:37
*** GaryPoster has quit IRC21:48
*** sunhome has joined #zope3-dev21:54
*** sunhome has left #zope3-dev21:55
*** bskahan has quit IRC22:12
projekt01SteveA, did you see the pagelet implementation?22:20
*** Aiste has quit IRC22:23
*** SteveA__ has joined #zope3-dev22:39
SteveA__projekt01: nope22:40
SteveA__projekt01: got some urls or paths in a checkout to point me at?22:40
SteveA__what is a pagelet?22:41
* SteveA__ reads the README.txt22:41
projekt01ZPT code registred as a adapter which can be used in another page template22:42
SteveA__thanks, I'll take a look22:42
projekt01See also, this experimental skin use this pagelets22:43
*** SteveA has quit IRC22:44
*** SteveA__ is now known as SteveA22:44
projekt01There is also a demo package / pageletchooser22:46
*** tvon has joined #zope3-dev22:53
*** Aiste has joined #zope3-dev23:02
*** GaryPoster has joined #zope3-dev23:09
*** BjornT has quit IRC23:35
*** BjornT has joined #zope3-dev23:35
*** watzo has quit IRC23:40
*** __gotcha_ has joined #zope3-dev23:53
*** __gotcha has quit IRC23:57

Generated by 2.15.1 by Marius Gedminas - find it at!