Re: [Zope-dev] DAV collections, index_html, and HEAD
Can you file a collector issue please? -aj - Original Message - From: "Karl Anderson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 06, 2002 19:44 Subject: [Zope-dev] DAV collections, index_html, and HEAD > > Objects that inherit from Folder (and therefore from Collection) and > also have an index_html that's a Python method (or othewise > nonvanilla, presumably) return a 405 (Method Not Allowed) for HTTP > HEAD requests. > > Zope 2.5.1 raises on line 57 of Collection.py. The object raises if > its index_html member doesn't have a HEAD attribute. > > Surely it's a bug to only give HEAD for objects that return an > index_html via hasattr/getattr. What about getitem, > __bobo_traverse__, and __call__? Shouldn't we find the object to HEAD > via ZPublisher? And aren't we bypassing the access control checks, > anyway? > > Would it be a good idea to try and make up a HEAD response for > arbitrary attributes that don't support it (such as Python methods)? > Perhaps by publishing them internally, and picking whatever we can > from RESPONSE, computing Content-Length from the returned stream if > necessary? It's inefficient, but at least it's cache-friendly... and > better for tools (er, linbot) that assume that if it can't be found > via HEAD, it isn't there. > > Excerpt from Collection.HEAD(): > > # Note that we are willing to acquire the default document > # here because what we really care about is whether doing > # a GET on this collection / would yield a 200 response. > if hasattr(self, 'index_html'): > if hasattr(self.index_html, 'HEAD'): > return self.index_html.HEAD(REQUEST, RESPONSE) > raise 'Method Not Allowed', ( > 'Method not supported for this resource.' > ) > raise 'Not Found', 'The requested resource does not exist.' > > > > > > persephone ~/tmp= telnet viii.dclxvi.org 80 > Trying 206.163.69.253... > Connected to viii.dclxvi.org. > Escape character is '^]'. > HEAD /blog HTTP/1.0 > HEAD /blog HTTP/1.0 > > > HTTP/1.1 405 Method Not Allowed > Date: Thu, 06 Jun 2002 02:22:40 GMT > Server: Apache/1.3.12 (Unix) mod_ssl/2.6.6 OpenSSL/0.9.5a > Bobo-Exception-File: /usr/local/zope/2-5-1/lib/python/webdav/Collection.py > Bobo-Exception-Line: 57 > Bobo-Exception-Type: Method Not Allowed > Bobo-Exception-Value: bobo exception > Connection: close > Content-Location: http://viii.dclxvi.org/blog/ > Ms-Author-Via: DAV > X-Powered-By: Zope (www.zope.org), Python (www.python.org) > Content-Length: 2106 > Content-Type: text/html > > > -- > Karl Anderson [EMAIL PROTECTED] http://www.monkey.org/~kra/ > > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) > ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DAV collections, index_html, and HEAD
Objects that inherit from Folder (and therefore from Collection) and also have an index_html that's a Python method (or othewise nonvanilla, presumably) return a 405 (Method Not Allowed) for HTTP HEAD requests. Zope 2.5.1 raises on line 57 of Collection.py. The object raises if its index_html member doesn't have a HEAD attribute. Surely it's a bug to only give HEAD for objects that return an index_html via hasattr/getattr. What about getitem, __bobo_traverse__, and __call__? Shouldn't we find the object to HEAD via ZPublisher? And aren't we bypassing the access control checks, anyway? Would it be a good idea to try and make up a HEAD response for arbitrary attributes that don't support it (such as Python methods)? Perhaps by publishing them internally, and picking whatever we can from RESPONSE, computing Content-Length from the returned stream if necessary? It's inefficient, but at least it's cache-friendly... and better for tools (er, linbot) that assume that if it can't be found via HEAD, it isn't there. Excerpt from Collection.HEAD(): # Note that we are willing to acquire the default document # here because what we really care about is whether doing # a GET on this collection / would yield a 200 response. if hasattr(self, 'index_html'): if hasattr(self.index_html, 'HEAD'): return self.index_html.HEAD(REQUEST, RESPONSE) raise 'Method Not Allowed', ( 'Method not supported for this resource.' ) raise 'Not Found', 'The requested resource does not exist.' persephone ~/tmp= telnet viii.dclxvi.org 80 Trying 206.163.69.253... Connected to viii.dclxvi.org. Escape character is '^]'. HEAD /blog HTTP/1.0 HEAD /blog HTTP/1.0 HTTP/1.1 405 Method Not Allowed Date: Thu, 06 Jun 2002 02:22:40 GMT Server: Apache/1.3.12 (Unix) mod_ssl/2.6.6 OpenSSL/0.9.5a Bobo-Exception-File: /usr/local/zope/2-5-1/lib/python/webdav/Collection.py Bobo-Exception-Line: 57 Bobo-Exception-Type: Method Not Allowed Bobo-Exception-Value: bobo exception Connection: close Content-Location: http://viii.dclxvi.org/blog/ Ms-Author-Via: DAV X-Powered-By: Zope (www.zope.org), Python (www.python.org) Content-Length: 2106 Content-Type: text/html -- Karl Anderson [EMAIL PROTECTED] http://www.monkey.org/~kra/ ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] __setattr__ and acquisition ( was RE: __getattr__and acquisition)
The only way I know is to put a wrapped object in a ._v_attribute, which means a volatile attribute. You can put, for instance, a wrapped self in, for instance self._v_alterEgo, this way you can do wrapped transversals thru it. How do you get a wrapped self to put there is an exercise left to the reader :-) tip: it's no use trying to do it in .__setstate__, as self is not wrapped there either, last I checked. On Wed, 2002-06-05 at 16:24, Erik A. Dahl wrote: > Yep. This is a problem for me I'm trying to find something through > acquisition in my __setattr__. Self is totally unwrapped. Can anyone > think of a creative solution? aq_acquire doesn't help because self is > not a wrapped object. :( Can't pass in the object I want because the > whole point of the setattr is to get around the function call. > -- Ideas don't stay in some minds very long because they don't like solitary confinement. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Using propertysheets?
Lennart Regebro wrote: > I'm making a Zope product (in python) where I want the users to have control > over what properties that exist. At the same time I don't want the users to > have to deal with having all properties in one big mess under the standard > Property-tab. > > So, my question is then: Should I use the PropertySheets class for this, and > if yes, does anybody have any example code, becuase it's not immediately > obvious how to use it. I think it should work well with PropertyManager Usage (works for me): - Define your own edit form - Derive your class from PropertyManager - Add a propertysheet to a class instance, eg.: def __init__(self): self.propertysheets.manage_addPropertySheet('advanced', 'advanced') - Add a prop: advanced.manage_addProperty('something', 0, 'int') - Do something with your propsheet, eg. update it: adv = self.propertysheets.get('advanced') if REQUEST is not None: return self.manage_advancedForm( REQUEST, manage_tabs_message='Advanced Settings updated.', ) - Or read a property: self.propertysheets.get('advanced').something If you're having problems just shout. cheers! peter. > Best Regards > > Lennart Regebro > Torped Strategi och Kommunikation AB > > > > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) > > ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Testing Zope Products with Python Debugger
On Wed, 5 Jun 2002, Robert Rottermann wrote: > Just install a second Zope and have it running from an other Port. You don't even have to install a second zope. Just use an INSTANCE_HOME setup to start zope with a different port and different Data.fs. --RDM ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Using propertysheets?
I'm making a Zope product (in python) where I want the users to have control over what properties that exist. At the same time I don't want the users to have to deal with having all properties in one big mess under the standard Property-tab. So, my question is then: Should I use the PropertySheets class for this, and if yes, does anybody have any example code, becuase it's not immediately obvious how to use it. Best Regards Lennart Regebro Torped Strategi och Kommunikation AB ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] multiple monkeypatches
On Thu, Jun 06, 2002 at 09:24:58AM -0400, Casey Duncan wrote: > > I am going to experiment with ExternalEditor to see if I can dynamically > patch manage_main reliably rather than replacing it outright. If I work > out a reliable scheme, I'll write a how-to on it. Then maybe other > products can then use the same technique. Couldn't there be a plugin mechanism for the management interface ? I can see three sort of plugins : Top plugin : * will be displayed once at the top of the ZMI (below tabs) e.g. ZShell Line plugin : * will be displayed once for each object (on each line) e.g. ExternalEditor Bottom plugin : * will be displayed once on the buttons line e.g. Your_product_of_choice Then every product would just have to register itself as a ZMITopPlugin, ZMILinePlugin, or ZMIBottomPlugin, or both. then the ZMI (main.dtml in fact) would just have to loop for each list of registered plugins whenever its needed : once at the top, once for each line listing objects, and once for the bottom. and if ZMILinePlugins could set a filter to be called only for some metatypes this would be really cool ! Any comment ? BTW Casey and others, if you need some help then I'd be pleased to do whatever I can, with a small amount of free time though... > The problem is somewhat easier to solve for methods since you can detect > whether they have already been replaced (with func_globals) and you can > do the old "run my code and call the old one" trick. agreed, unfortunately... bye, Jerome Alet ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] re: First call to external method after restart fails
Problem solved after installing ExternalMethod.py from cvs. Thanks! Emile van Sebille [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] re: First call to external method after restart fails
This has been fixed in CVS in the trunk and the 2.5 branch. Zope 2.6 will contain the fix. To get the fix for 2.5, run the 2.5 branch of CVS or just update the ExternalMethod product from the one in CVS. -Casey On Wed, 2002-06-05 at 23:11, Emile van Sebille wrote: > I found this post from Ted Skolnick but saw no follow-ups, and I am > having the same problems. Ted, did you get this resolved? > > > I have an external method that takes 3 params. After I restart Zope ( > > running on Linux ), I get the following error on my first call... > > > > Error Type: TypeError > > Error Value: rmlToPDF() takes at least 3 arguments (0 given) > > > > All subsequent calls work fine (i.e. a refresh in my browser, and no > more > > error, my external method works ). I restart Zope as root. Anyone > ever > > see this before? > > I just upgraded an account from 2.4.x to 2.5 binary on linux. > > > -- > > Emile van Sebille > [EMAIL PROTECTED] > > - > > > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] multiple monkeypatches
I really think the only way to make this work is to design the products with this in mind. Perhaps by developing a defacto standard for doing monkey patches nicely. I am going to experiment with ExternalEditor to see if I can dynamically patch manage_main reliably rather than replacing it outright. If I work out a reliable scheme, I'll write a how-to on it. Then maybe other products can then use the same technique. The problem is somewhat easier to solve for methods since you can detect whether they have already been replaced (with func_globals) and you can do the old "run my code and call the old one" trick. -Casey On Wed, 2002-06-05 at 18:37, Jim Penny wrote: > On Wed, Jun 05, 2002 at 10:51:45PM +0100, Adrian Hungate wrote: > > PatchKit handles this for you (If you ask it to). > > > > :) > > > > Adrian... > > I am not sure that I understand. I need to be able to do a > "cumulative monkey patch". Suppose that there were two independent > products which both modified manage_main (without loss of generality, > say ExternalEditor and ZShell). Most people use neither, some people > use one, some use the other, and some use both. > > It is the case of people using both that I am interested in. To do > this appears to me to require that I have access to the DTML form of > any previous monkey patches to manage_main so that I can decide > if I can safely patch the running version to meet the needs of both > products. > > Is this possible? > > If both products were using PatchKit would it be possible? How about > if only one used PatchKit? > > Thanks > > Jim > > > > -- > > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )