IRC log of #zope3-dev for Thursday, 2005-01-20

*** stub has joined #zope3-dev00:04
*** jan_s has joined #zope3-dev00:07
*** RaFromBRC|afk is now known as RaFromBRC00:15
*** tvon has joined #zope3-dev00:48
*** jan_s_ has joined #zope3-dev00:52
*** bskahan has quit IRC00:54
*** Nicolas__ has quit IRC00:54
*** d2m has quit IRC00:57
*** jan_s has quit IRC01:05
*** alga has quit IRC01:19
*** RaFromBRC has quit IRC03:01
*** srichter has joined #zope3-dev04:07
*** ChanServ sets mode: +o srichter04:07
*** tvon has quit IRC04:33
*** SteveA has quit IRC04:33
*** tvon has joined #zope3-dev04:34
*** SteveA has joined #zope3-dev04:34
*** RaFromBRC has joined #zope3-dev04:59
*** povbot has joined #zope3-dev05:07
*** povbot` has quit IRC05:07
*** deo has quit IRC05:17
Damascenei'm not sure if there are any good examples of how to use <menu and <menuItem... even if tey are defined in zcml, it isn't clear how to call them in TAL.  grepping for <menu it appears that it should be something like view context/@@view_get_menu/zmi_views, but instead i'll use the menu id instead of zmi_views as the name?  then "menuid/action" as the URL path?05:42
*** WebMaven has joined #zope3-dev05:51
WebMavenJ1m: you still up?05:51
Damascenedarn, i thought i had an answer to my question already haha05:52
WebMavend4 7073 15 c0m1n905:53
WebMavenph33r d4 707305:53
DamasceneWebMaven:  have you used the <menu commands?05:55
WebMaven707e: d4 n3x7 93n3r4710n05:56
WebMavennope.05:56
*** bskahan has joined #zope3-dev06:23
*** Suresh-E has joined #zope3-dev06:25
*** jan_s_ has quit IRC06:37
*** bskahan has quit IRC07:39
*** __gotcha__ has joined #zope3-dev08:00
*** sashav has quit IRC08:14
*** __gotcha has quit IRC08:18
*** bskahan has joined #zope3-dev08:41
*** RaFromBRC has quit IRC08:42
zagymoin09:11
*** d2m has joined #zope3-dev09:40
*** sashav has joined #zope3-dev09:46
*** bskahan has quit IRC09:54
*** hdima has joined #zope3-dev10:15
*** Theuni has joined #zope3-dev10:34
*** `anthony has quit IRC10:50
*** stub has quit IRC10:59
*** `anthony has joined #zope3-dev11:03
*** MalcolmC has joined #zope3-dev11:03
*** jhauser has joined #zope3-dev11:14
*** mooded has joined #zope3-dev11:14
*** vlado has joined #zope3-dev11:29
*** [nicknam] has joined #zope3-dev11:47
*** jhauser has quit IRC11:48
*** jhauser has joined #zope3-dev11:49
*** `anthony has quit IRC12:04
*** `anthony has joined #zope3-dev12:16
*** J1m_ has joined #zope3-dev12:17
*** mgedmin has joined #zope3-dev12:23
*** jhauser_ has joined #zope3-dev12:47
*** jhauser has quit IRC13:04
*** stub has joined #zope3-dev13:05
*** jhauser_ has quit IRC13:09
*** jhauser has joined #zope3-dev13:09
*** J1m_ has quit IRC13:34
*** regebro has joined #zope3-dev14:26
regebroHowdy! Here I am again with my pestering of Z3 internals to get Five to do a little bit more. ;)14:26
regebroI just looked over my code for getting menus working in Five, and I need to override almost all of the Z3 code, because of one tiny change between Zope3 and Zope2:14:27
regebrozope.security.management.checkPermission looks for an attribute "interaction" on zope.thread.local(), and then calls checkPermission on that.14:27
regebroOf course, under Zope2 there is no such attribute, so it fails, so checkPermission needs to be another checkPermission, and it ends up with basically copy/pasting all of the menu code into Five.14:28
regebroKinda annoying.... Do anybody have any diea of how to NOT need to do this, but for example make the zope.thread.local() object have an interaction wvwn under Five?14:29
SteveAwell...14:29
SteveAthe interaction says who the logged in principal is, and what the request is14:30
SteveAif there is some "owned" code running, like an untrusted dtml method, then the owner of that code is also another principal in the interaction14:30
SteveAzope2's publisher / traverser needs to set these things in the interaction; or, the security policy needs to be changed to one that looks in the securitycontext (or whatever that is called in zope2) instead of the interaction14:31
SteveAthe interaction in zope3 has replaced what was the "security context" in zope 214:31
regebroHmmm. OK. There are some paths to walk down there... either have a "zope2 security policy" for Zope3, or update the publisher/traverser to behave more like Zope3s...14:32
SteveAthe information needed by the security policy (actually, the authorization policy) should be available in zope2 anyway14:33
SteveAas its security context14:33
*** srichter has quit IRC14:34
regebroSure, it's available, Zope3 just doesn't look in the correct place. ;)14:34
SteveAthe authorization policy in zope3 is pluggable14:34
SteveAin my project, i'm using a totally different policy14:34
regebroOh, cool, then you know where you configure that! :)14:35
regebroI douns the simplepolicies.py14:35
regebrodouns/found14:35
SteveAor, you could write an "interaction" for zope2 that gets its information from zope2 sources14:35
SteveAthe interaction can be set, you see14:35
regebroAha, that also sounds like a good idea. Where is that set?14:35
SteveAit *should* be set in an event, but I think it is set in ZopePublication14:38
SteveAbecause that needs some refactoring14:38
regebroAh, yeah, it makes newInteraction and endInteraction. Of course, that part is not used at all by Five, so I would need to do something similar in the Zope2 publisher.14:41
regebroProbably too complicated...14:41
*** niemeyer has joined #zope3-dev14:42
SteveAi suggest starting off by just replacing the authorization policy14:42
regebroOK. Thanks a million times, anyway, very helpful, I know where to dig now! Thanks!14:43
SteveAhappy digging14:44
*** niemeyer has quit IRC15:07
*** niemeyer has joined #zope3-dev15:08
*** Nicolas__ has joined #zope3-dev15:37
*** srichter has joined #zope3-dev15:38
*** adel has joined #zope3-dev15:42
*** ChanServ sets mode: +o srichter15:43
regebroWell, replacing the authorization doesn't help, because there is still no interactions attribute on the local thread.15:46
*** gintas has joined #zope3-dev15:48
SteveAregebro: the authorization policy (sometimes called the security policy) doesn't care about interactions, afair15:48
regebroPossibly, but zope.security.management.checkPermission does. And it is called from loads of places.15:49
SteveAhmm15:50
* SteveA -> lunch15:50
regebroHmm. THAT worked. Interesting. I wonder what side effects that will have. :P15:51
regebroIn __bobo_traverse__ I just set zope.app.management.thread_local.interaction = getSecurityManager().15:52
regebroUGLY. But it gets rid of the errors.15:52
*** mgedmin has quit IRC15:58
*** Suresh-E has left #zope3-dev16:13
*** gintas has quit IRC16:16
*** stub has left #zope3-dev16:17
Damascenedarn, i missed mgeadmin, probably the only person who i know for a fact has used <menu zcml.  ;)16:21
regebroWhat is menu zcml?16:23
*** Nicolas__ has quit IRC16:30
*** __gotcha__ is now known as __gotcha16:47
*** srichter has quit IRC16:49
*** srichter has joined #zope3-dev16:50
*** _nicknam_ has joined #zope3-dev16:50
jhausercan I do two 'for='interface...' statements into one adapter definition?16:51
*** _nicknam_ is now known as apoirier16:53
srichterjhauser: yes, but it will define a multiadapter16:54
srichternot an adapter that works for both interfaces16:54
jhauserah ok16:54
jhauserand how to the later?16:54
*** hdima has quit IRC16:54
*** adel is now known as adel|w16:56
*** [nicknam] has quit IRC16:59
J1mjhauser, just use 2 adapter directives17:00
jhauserok :-) thanks17:00
jhauserbut the for="*" ist not a multiadapter definition right?17:00
J1mno17:00
J1m* means "any" interface17:01
Damasceneregebro:  it's like <menu name="mainnav"> <menuItem action="@@products.html" for="some.Int" menu="mainnav">17:06
Damascenebut the zcml reference is incorrect (if you put down only the 'required' ones, it's not enough to launch without errors.  and no one seems to mention how to use this in TAL.17:06
regebroAh, I thought you meant like a file. menu.zcml or so. ;)17:06
regebroWell, it should tell you what is required. Unforutnately, I haven't built any TAL menues and can't help you there.17:08
regebroBasically, you do globalBrowserMenuService.getMenu() to get the menu entries, but more than that I don't know.17:09
*** zagy has quit IRC17:27
*** srichter has quit IRC17:27
*** mooded has left #zope3-dev17:29
Damasceneregebro:  ah, okay.  i'll check.  i thought the browsermenuservice was going away hmm i'll recheck.17:43
*** mkerrin has joined #zope3-dev17:43
regebroDamascene, Oh, maybe it is, then I guess you get the service via getGlobaService or somesuch method.17:44
*** tvon has quit IRC17:45
*** mgedmin has joined #zope3-dev17:51
*** mkerrin has quit IRC17:57
*** Nicolas__ has joined #zope3-dev17:59
*** bskahan has joined #zope3-dev18:07
*** tvon has joined #zope3-dev18:09
*** tav|offline is now known as tav18:20
*** tvon has quit IRC18:21
*** adel|w has quit IRC18:22
*** tvon has joined #zope3-dev18:33
*** senra has joined #zope3-dev18:48
*** mgedmin has quit IRC18:51
*** mgedmin has joined #zope3-dev18:51
*** vlado has quit IRC18:53
*** deo has joined #zope3-dev18:56
*** regebro has quit IRC19:13
*** sashav has quit IRC19:31
*** MalcolmC has quit IRC19:44
*** Nicolas__ has left #zope3-dev20:01
*** senra has quit IRC20:27
*** bskahan has quit IRC20:27
*** bskahan has joined #zope3-dev20:31
SteveAJ1m: one of my team is having problems with httpresponse.write().  I'm reading the code and I think it is doing the wrong thing.  Got time to talk about it, or maybe i should mail the list?20:34
*** zagy has joined #zope3-dev20:40
*** senra has joined #zope3-dev20:45
J1mI can take time to talk about it.20:51
SteveAthanks20:51
SteveAresponse.write() just calls through to response.output().20:52
SteveAoutput() ensures that the headers have been sent, and that the charset is set to something.20:53
J1mactually, write ensures that headers have been sent20:53
SteveAmaybe I'm looking at out-of-date code then20:54
J1m    def write(self, string):20:54
J1m        """See IApplicationResponse20:54
J1m        Return data as a stream20:54
J1m        HTML data may be returned using a stream-oriented interface.20:54
J1m        This allows the browser to display partial results while20:54
J1m        computation of a response to proceed.20:54
J1m        The published object should first set any output headers or20:54
J1m        cookies on the response object and encode the string into20:54
J1m        appropriate encoding.20:54
J1m        Note that published objects must not generate any errors20:54
J1m        after beginning stream-oriented output.20:55
J1m        """20:55
J1m        if not self._wrote_headers:20:55
J1m            self.outputHeaders()20:55
J1m            self._wrote_headers = True20:55
J1m        self._outstream.write(string)20:55
J1m    def output(self, data):20:55
J1m        """Output the data to the world. There are a couple of steps we have20:55
J1m        to do:20:55
J1m        1. Check that there is a character encoding for the data. If not,20:55
J1m           choose UTF-8. Note that if the charset is None, this is a sign of a20:55
J1m           bug! The method setCharsetUsingRequest() specifically sets the20:55
J1m           encoding to UTF-8, if none was found in the HTTP header. This20:55
J1m           method should always be called when reading the HTTP request.20:55
J1m        2. Now that the encoding has been finalized, we can output the20:55
J1m           headers.20:55
J1m        3. If the content type is text-based, let's encode the data and send20:55
J1m           it also out the door.20:55
J1m        """20:55
J1m        if self._charset is None:20:55
J1m            self.setCharset('utf-8')20:55
J1m        if self.getHeader('content-type', '').startswith('text'):20:56
J1m            data = self._encode(data)20:56
J1m            self._updateContentLength(data)20:56
J1m        self.write(data)20:56
J1mactually, I'm confused20:56
J1moutput calls write20:56
J1mok, write writes to the outstream20:56
SteveAah, okay.  that's not what i have.  i should update.20:56
J1mNote that, someday, I'd like to revisit this in light of wsgi20:56
SteveAyeah20:56
SteveAwhen the headers are sent, content-length is set even when write() was used directly, at least in the code I'm looking at20:56
SteveAi think that when write was used directly, content-length shouldn't be set unless it was explicitly set20:57
J1mReally, streaming output really needs to be thought through20:57
J1mIt's hard because you have to provide a content length20:57
SteveAyou don't have to.  you just should.20:57
J1mSo, if you don't know it. you have to use chunking20:57
J1mNo, you really have to.20:57
J1mI'm 99% sure the spec says you must20:57
SteveAhttp://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1320:58
SteveAdefinitely a should, not a must20:58
SteveAand, in one thing one of my chaps is trying to do, we can't -- it is generating a tar file on the fly and serving it up based on data in a database20:58
J1mYou could use the chunking protocol20:59
SteveAhmm... looks complex21:00
* J1m shrugs21:00
J1manway, write doesn't seem to enforce that it is set21:01
*** sashav has joined #zope3-dev21:02
J1moe maybe it does ...21:02
SteveAi'll upgrade the zope3 we're using and see if we're still having a problem21:02
SteveAthe code i'm looking at is quite aggressive about adding a content-length header if there is none set21:03
J1mactually, it does set the content length.21:03
J1mI'd be OK with changing this.21:04
J1mExcept in the case of the output method, there's really no right way to guess the content length.21:04
SteveAso, move the guessing from getHeaders() into output()21:05
J1mI'd really like to see a thoughtful streaming proposal.21:05
*** tvon|x31 has joined #zope3-dev21:05
SteveAand so, it won't effect using write()21:05
J1msomething like that21:05
* J1m doesn't want to figure out the details :)21:05
SteveAwould a streaming proposal include chunking stuff?21:05
J1myes21:05
*** tvon has quit IRC21:06
*** tvon|x31 is now known as tvon21:06
J1mI also think we need to take a harder look at output.21:06
J1mBut that's beside the point.21:06
J1mA streaming protocol should do something efficient when handed a file-like object.21:06
J1mAnd, of course, it should take wsgi into account.21:07
* SteveA wonders whether twisted has solved this one already21:07
SteveAthanks jim.21:08
*** gintas has joined #zope3-dev21:31
*** sashav_ has joined #zope3-dev21:32
*** sashav_ has quit IRC21:40
*** sashav has quit IRC21:48
*** apoirier has quit IRC21:49
*** senra has left #zope3-dev21:53
*** gintas has quit IRC22:05
*** tvon has quit IRC22:30
*** niemeyer has quit IRC22:39
*** Aiste has quit IRC22:40
*** sashav has joined #zope3-dev22:45
*** RaFromBRC has joined #zope3-dev22:53
*** bskahan has quit IRC23:26
*** srichter has joined #zope3-dev23:49
*** mgedmin has quit IRC23:56
*** ChanServ sets mode: +o srichter23:57

Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!