[Zope] Building dynamically class instances using external methods.
Question: I am running Zope2.2.2 under python1.5.2 on a linux machine. The following situation: I have an external Method which creates dynamically an instance from of a class depending on some input to a function contained in this method. In short the code (of the external method) class Classname: def function1 def function2 ..etc. def createInstance(argument) x = Classname(argument) return x Where createinstance is the method that is invoked initially from zope. Everything works fine, the method returns something like using "__allow_access_to_unprotected_subobjects__ = 1" in the class definition it is possible to access all methods of the class within Zope. Among others the class holds a method 'dump' who should 'pickle' the objects instance (using the python 'pickle' module), more precise should return a string represantion of itself. This works fine when tested in a normal python session. (where the method returns contrary to above: <__main__.Classname instance at ...>) Called from Zope this does not work. The pickle module raises an error: .. File /usr/lib/python1.5/pickle.py, line 818, in dump File /usr/lib/python1.5/pickle.py, line 97, in dump File /usr/lib/python1.5/pickle.py, line 198, in save File /usr/lib/python1.5/pickle.py, line 400, in save_inst Error type: Attribute error, Error Value: __module__ QUESTION: Is there any possibility to get these things work. ? (or is it really awkward stuff ???) Maybe related questions: QUESTION 2: What does the "?" mark in the generated objects string representation means ? Is it neccessary to 'anchor' (sorry for my terminology) the object within some other object ? And: QUESTION 3: The lifetime of an instance has should not to be longer than the current REQUEST is performed, is there any possibility to create the instance as an subobject of the current REQUEST ?? Any help and advice would be highly appreciated... regards Hannes. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] PythonMethod and accessing objects in the ZODB
I'm using the PythonMethod product (latest Version) and Zope2.2.2. The method lives inside a ZClass, which has an common instance propertysheet. Also the method gets an 'self' as argument. Question 1: How do i access the attributes stored within this propertysheet within the method, while self.title and self.id gives the desired results. self.propertysheet.propertyname (among other experiments) raises an error. Question 2: How do I access objects stored elsewhere in the ZODB, for example self.REQUESTpath_to_object.object will raise an error.. Thanks in advance. Hannes. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Verify Watermark.
In Zope2.1.6 there was a function called 'verify watermark' in module Accesscontrol.User. This function seems to have gone in the 2.2.2 release. My question: Is there any direct replacement for this method ? Or at least a some kind of equivalent code ? thanks in advance, Hannes ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] ZCatalog question. boolean and wildcards.
Im running Zope 2.2.2 on Linux 2.2.13. When mixing boolean operators and wildcards '*' in queries within a Textindex the 'AND' operator is replaced by 'OR'. Also, the possibility of constructing nested terms using brackets seems to be not supported (contrary to the chapter 'Searching and indexing' from the Zope book). The setting is straightforward, several indexes (text-index, keyword-indexes) are used indexing a about 5000 Zclasses. Are there any patches to apply or what else can i do ? Thanks in advance. Hannes. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )