[Zope-dev] how to get the icon of a product
Hi I try to get the icons of the installed products I try to get it with the self.all_meta_types()/instance/icon My better result is something like: misc_/Audio/mp3.gif with these path I can use: self.unrestrictedTraverse(icon) where icon is the path above (misc_/Audio/mp3.gif) With these approach some icons are correct other are not found is there any good way to get these info? Thanks a lot!! ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Unexpected result
Hi I try to validate a formulator object with a python script If an error was submitted the python script would acquire again the zope page template that render the formulator with the error messages My problem is than when I try to return the ZPT render Zope process the return and convert , and to the lt; gt; and amp; I try to conver these codes, change the content-type and so on but the problem persists How can I solve these question? TIA ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] strange path
Ok, thanks and sorry for the error - Original Message - From: Kapil Thangavelu [EMAIL PROTECTED] To: Garito [EMAIL PROTECTED] Cc: Lista Oficial de Zope [EMAIL PROTECTED] Sent: Sunday, March 21, 2004 8:45 AM Subject: Re: [Zope-dev] strange path most likely Concepto object id is not being set properly. this question should be addressed to [EMAIL PROTECTED] this list is for the development *of* zope itself not development with zope. -kapil On Sat, 2004-03-20 at 10:51, Garito wrote: Hi on a ZPT I put a here/absolute_url and these is the response: http://localhost:8080/Plantillas/Pruebas/Objetos///Minima the correct path would be: http://localhost:8080/Plantillas/Pruebas/Objetos/Concepto/Vistas/Minima What's happening here? TIA __ ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] TALES context
Hi I try to create another context object for TALES like 'container' or 'here' Is there any mechanism to create these? Like PUT_factory for FTP/WevDav or meta_types for the products Thanks!! ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] strange path
Hi on a ZPT I put a here/absolute_url and these is the response: http://localhost:8080/Plantillas/Pruebas/Objetos///Minima the correct path would be: http://localhost:8080/Plantillas/Pruebas/Objetos/Concepto/Vistas/Minima What's happening here? TIA ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] How to create a product with all_meta_types and the name of the product
Hi Chris! Want I want exactly is to create a product's object by his name programmatically not by the construction form Is this posible? Thanks!!! - Original Message - From: Chris Withers [EMAIL PROTECTED] To: Garito [EMAIL PROTECTED] Cc: Lista Oficial de Zope [EMAIL PROTECTED] Sent: Friday, March 12, 2004 9:37 AM Subject: Re: [Zope-dev] How to create a product with all_meta_types and the name of the product Garito wrote: In the information retrieved by self.all_meta_types()['product']['action'] I can retrive the 'manage_addProduct' string, 'product' string but I don't retrieve manage_addMyProductManageAdd but I retrieve manage_addMyProductManageAddForm (this is the form of the constructor) Any idea? Loose the HTML encoding in your mails for starters ;-) The ngo find the code which builds the Add dropdown in the ZMI, since that appears to do what you want... Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] How to create a product with all_meta_types and the
Hi Max I understand what you explain but what about if I install a new product? Rewrite the factory? I think is not a good solution don't you think? Thanks!! - Original Message - From: Max M [EMAIL PROTECTED] To: Garito [EMAIL PROTECTED] Cc: Lista Oficial de Zope [EMAIL PROTECTED] Sent: Friday, March 12, 2004 10:34 AM Subject: Re: [Zope-dev] How to create a product with all_meta_types and the Garito wrote: Hi Chris! Want I want exactly is to create a product's object by his name programmatically not by the construction form Is this posible? You cannot know the name of the constructor function, unless you read the source. The constructors added to Zope during the product initialisation can be both forms and actual function methods. There is no way of knowing which. And there can be more than two. So you would need to write a factory function based on the info you can get from the source. Ie. in an external method. Something like:: def portal_factory(self, parent, portal_type, id='', title='',): Adds the content. A factory function. # generate a general id if id == '': id = self.ZopeTime().strftime(portal_type + '_%Y%m%d_%H%M%S') zope_factory = parent.manage_addProduct # add the content if 'Document' == portal_type: zope_factory['Document'].manage_addDocumentAction(id) elif 'Some Type' == portal_type: zope_factory['Some Type'].manage_addSomeTypeAction(id) else: raise 'Error adding portal_type' # get the newly added content obj = getattr(parent, id) # Add the title obj.title = title return obj -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] How to create a product with all_meta_types and the name of the product
Hi all I would like to create a product knowing the name of these product. How to do it? I arrive to product but I don't know how to create it and set to de container With these code self['manage_addProduct']['product'].manage_addMyProductManageAdd(id, content) In the information retrieved by self.all_meta_types()['product']['action']I can retrivethe 'manage_addProduct' string, 'product' string but Idon'tretrieve manage_addMyProductManageAdd but Iretrievemanage_addMyProductManageAddForm (this is the form of the constructor) Any idea? Thanks ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Execution context
Hi all Finally I solve my problem with Tres Seaver's help (THANK YOU) I overridethe __bobo_traverse__ with: def __bobo_traverse__(self, Request, Name):import sysif sys._getframe(1).f_code.co_name == "traverse":return getattr(self, Name)else:return self.Propiedad(Name) self.Propiedad is the fuction than neutralices (I call these mechanism Neutralization) the content of my object When You executes ZMI sys._getframe(1).f_code_co_name returns traverse Thanks again Tres Seaver! ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Execution context
Thank you for your help I would like to overrite some properties in my product with a know property (Maestro) For example I define an object: ObjectA PropertyA PropertyB PropertyC Maestro - this property has a transversal path to ObjectB ObjectB PropertyD Then I would like to call ObjectA.PropertyD - these code calls ObjectB.Property With these code I would like to construct a soft link mechanism I try to override the __bobo_traverse__ with these code: def __bobo_traverse__(self, Request, Name): Maestro = getattr(self, '.Maestro', None) if Maestro is not None: obj = self.unrestrictedTraverse(Maestro.contenido) Acquirido = obj.__of__(self) return getattr(Acquirido, Name) return getattr(self, Name) these override works fine but is not recursive in the Maestro structures If I use these other override : def __bobo_traverse__(self, Request, Name): Propiedad Obj = self Maestro = getattr(Obj, '.Maestro', None) Paso = 1 while Maestro is not None: Obj = self.restrictedTraverse(Maestro.contenido).__of__(self) Maestro = getattr(Obj, '.Maestro', None) Paso += 1 if Paso == 15: break if hasattr(Obj, Name): return getattr(Obj, Name) return getattr(self, Name) The recursive Maestro mechanism works fine but in the ZMI I obtain the object in the Maestro structure. For me is an error because I can't see the real content of the object Do you understand my problem? Thanks again!!! PD: sorry for my english! - Original Message - From: Tres Seaver [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 3:33 AM Subject: [Zope-dev] Re: Execution context Garito wrote: Can I know the execution contexto of an object? I would like to know if the object is call by ZMI or DTML or Page Templates etc is it posible? Perhaps; I am not sure I can see why it would be *desirable*. Given that Scripts, DTMLMethods, etc., try pretty hard to push themselves onto the execution stack just as though they were methods, you could probably introspect the result of calling 'sys._getframe(1)' to figure out what kind of thing called you. From the Python Cookbook, #14.7: def whoami(): ... Return the name of the calling function. ... ... import sys ... return sys._getframe(1).f_code.co_name ... def foobar(): ... print whoami() ... foobar() foobar Tres. -- === Tres Seaver[EMAIL PROTECTED] Zope Corporation Zope Dealers http://www.zope.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Execution context
Hi all Can I know the execution contexto of an object? I would like to know if the object is call by ZMI or DTML or Page Templates etc is it posible? Thank you ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] How to know the execution context in a product
Hi I try to know the context of the execution of my product to overrite the values of the properties of my product It will be like a sof-link I have the property Master. These property is an url to the real object When I execute the ZMI I would like to see the real content of my object but when I consult a property in a ZPT or a DTML or another context I would like to retrieve the property in the context of the Master object How to make these? Thank you ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Explicit acquisition and object context
Hi I have these function def Propiedad(self, Name): """Propiedad""" Obj = self Maestro = getattr(Obj, 'Maestro', None) Paso = 1 while Maestro is not None: Obj = self.restrictedTraverse(Maestro.contenido).__of__(self) Maestro = getattr(Obj, 'Maestro', None) Paso += 1 if Paso == 15: break if hasattr(Obj, Name): return getattr(Obj, Name) return getattr(self, Name) these code try to get the object Maestro, and recursively search the forMaestro's until is notfound Widththese code I try to use an object called Maestro to make soft links My problem istoacquirethe real context of self If I add inmy product thesefunction: def __bobo_traverse__(self, Request, Name): return self.Propiedad(Name) ZMI show me the soft link object and not the real self Has anyone idea to help me, please? Thanks ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] PUT_factory
Hi, all I try to override PUT_factory method in my container product I read in several webpages I need to create a PUT_factory method in my product to override these mechanism These method could be like: def PUT_factory(self, name, typ, body): return ZopePageTemplate(name, body, content_type=typ) In these case all the objects created by the WebDAV/FTP services will be ZopePageTemplates but these code doesn't work! :( Can anyone explain me the correct solution? Thanks!!! ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )