[Zope-dev] Zope Tests: 4 OK, 1 Failed
Summary of messages to the zope-tests list. Period Sat Jan 12 12:00:00 2008 UTC to Sun Jan 13 12:00:00 2008 UTC. There were 5 messages: 5 from Zope Unit Tests. Test failures - Subject: FAILED (failures=1) : Zope-trunk Python-2.4.4 : Linux From: Zope Unit Tests Date: Sat Jan 12 21:02:47 EST 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-January/008945.html Tests passed OK --- Subject: OK : Zope-2.7 Python-2.3.6 : Linux From: Zope Unit Tests Date: Sat Jan 12 20:56:45 EST 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-January/008941.html Subject: OK : Zope-2.8 Python-2.3.6 : Linux From: Zope Unit Tests Date: Sat Jan 12 20:58:15 EST 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-January/008942.html Subject: OK : Zope-2.9 Python-2.4.4 : Linux From: Zope Unit Tests Date: Sat Jan 12 20:59:46 EST 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-January/008943.html Subject: OK : Zope-2.10 Python-2.4.4 : Linux From: Zope Unit Tests Date: Sat Jan 12 21:01:16 EST 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-January/008944.html ___ Zope-Dev maillist - Zope-Dev@zope.org 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] zope2 webdav memory usage...
Jim Fulton wrote at 2008-1-11 18:20 -0500: ... BTW, in situations in which you don't know which objects to deactivate, an alternative is to call cacheGC on the connection frequently. This is fairly inexpensive and incremental. But, it can kill volatile variables as well -- which may lead to trouble, until we have implemented something like Garanteed lifetime for volatile variables. Current potential trouble includes: * inconsistent transactions in relational databases (as _v_ variables are used to hold the database connection) * broken Archetypes copy/move code (as _v_ variables are used to communicate with 'manage_afterAdd/beforeDelete further down the tree) -- Dieter ___ Zope-Dev maillist - Zope-Dev@zope.org 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] zope2 webdav memory usage...
On Jan 13, 2008, at 7:49 AM, Dieter Maurer wrote: Jim Fulton wrote at 2008-1-11 18:20 -0500: ... BTW, in situations in which you don't know which objects to deactivate, an alternative is to call cacheGC on the connection frequently. This is fairly inexpensive and incremental. But, it can kill volatile variables as well -- which may lead to trouble, until we have implemented something like Garanteed lifetime for volatile variables. Current potential trouble includes: * inconsistent transactions in relational databases (as _v_ variables are used to hold the database connection) This is an interesting case. * broken Archetypes copy/move code (as _v_ variables are used to communicate with 'manage_afterAdd/beforeDelete further down the tree) Perhaps volatile variables are a bad idea. They enable many subtle errors. OTOH, I fear that without them, people would resort to other tricks that might be even worse. What sort of lifetime would you consider appropriate for volatile variables? You example above suggests that they should stick around until a transaction boundary (not including savepoints). I wonder if there are other examples that might want something else. Or perhaps people should take the name volatile more seriously. Jim -- Jim Fulton Zope Corporation ___ Zope-Dev maillist - Zope-Dev@zope.org 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] zope2 webdav memory usage...
On Jan 13, 2008, at 10:40 AM, Jim Fulton wrote: On Jan 13, 2008, at 7:49 AM, Dieter Maurer wrote: Jim Fulton wrote at 2008-1-11 18:20 -0500: ... BTW, in situations in which you don't know which objects to deactivate, an alternative is to call cacheGC on the connection frequently. This is fairly inexpensive and incremental. But, it can kill volatile variables as well -- which may lead to trouble, until we have implemented something like Garanteed lifetime for volatile variables. I've got no problem with the current behavior of volatiles, I understand how they work. But personally I've not been able to successfully write walk code against very large databases that doesn't consume RAM without bound using only cacheGC. If I write the same type of code using _p_deactivate against each object I walk, I can keep memory under some sort of control. - C ___ Zope-Dev maillist - Zope-Dev@zope.org 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] can't pickle instancemethod objects in testcase
Thanks Andreas and Dieter, The explanation was quite simple, I set an attribute on an object that was a method like this:: class TestBase(ZopeTestCase.ZopeTestCase): def dummy_redirect(self, *a, **kw): self.has_redirected = a[0] if kw: print *** Redirecting to %r + (%s) % (a[0], kw) else: print *** Redirecting to %r % a[0] def afterSetUp(self): self._setupDBConnection() dispatcher = self.folder.manage_addProduct['MExpenses'] dispatcher.manage_addHomepage('mexpenses') self.mexpenses = self.folder['mexpenses'] self.mexpenses.http_redirect = self.dummy_redirect # NOTICE!! request = self.app.REQUEST sdm = self.app.session_data_manager request.set('SESSION', sdm.getSessionData()) self.has_redirected = False The reason for the dummy redirector is boring. The reason for the transaction.get().commit() is to not cancel everything when a ConflicrError happens during a very long-lasting file upload. Again, thanks. PS. Andreas, I did use your set_trace() tip on the ZODB code. Isn't Python great! On 08/01/2008, Dieter Maurer [EMAIL PROTECTED] wrote: Peter Bengtsson wrote at 2008-1-7 18:29 +: My code works fine in normal running zope but not when run as a testcase (I'm not using bin/zopectl test if that matters) I get the following error. I feel guilty since I've got this line in my code: transaction.get().commit() (Expense.py#4458) I remember having come across this error before but can't remember what the solution was. ... File /home/peterbe/zope/zope285/lib/python/ZODB/serialize.py, line 339, in _dump self._p.dump(state) File copy_reg.py, line 69, in _reduce_ex raise TypeError, can't pickle %s objects % base.__name__ TypeError: can't pickle instancemethod objects -- Apparently, you have an instancemethod in your test setup where you do not have one in the normal Zope. An alternative explanation could be that in your normal Zope additional pickle registrations are performed. If you would use, e.g., my CompiledExecutable product, then the import of this product would register code and instancemethod instances as picklable. A test setup may not import CompiledExecutables and its pickle registrations would be missing. A side note: Usually, it is a very bad idea to perform a full commit in a test. Such commits are incompatible with techniques that share (for efficiency reasons) part of the test setup among several tests. ZopeTestCase, e.g., makes use of such techniques. -- Dieter -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_renameObjects and AJAX
Garito wrote at 2008-1-11 19:55 +0100: ... Did you try to install the product? I try only products the description of which clearly indicates that I need them. You decided to let your code speak -- but this has no chance with me :-) -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_renameObjects and AJAX
What a pity! Doesn't matter but is a lost chance to understand the other If some time you would like to evaluate it I will thank you Thanks! 2008/1/13, Dieter Maurer [EMAIL PROTECTED]: Garito wrote at 2008-1-11 19:55 +0100: ... Did you try to install the product? I try only products the description of which clearly indicates that I need them. You decided to let your code speak -- but this has no chance with me :-) -- Dieter -- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] NamedTemplate.__call__ not returning anything
Hi, I have some code where I try to get a named template and render it and if it fails I render a default template instead. But this fails, presumably because the __call__ method of NamedTemplate does not return anything. From zope/formlib/namedtemplate.py (Zope 2.10): class NamedTemplate(object): def __init__(self, name): self.__name__ = name def __get__(self, instance, type=None): if instance is None: return self return component.getAdapter(instance, INamedTemplate, self.__name__) def __call__(self, instance, *args, **kw): self.__get__(instance)(*args, **kw) I seems strange to me that __call__ does not actually return anything. Is it just me? Now, I have some other code where NamedTemplate is working just fine, so there is probably nothing wrong with this __call__ method. So can anybody tell me what is wrong with my following code then? class Renderer(base.Renderer): default_template = ViewPageTemplateFile('vocabularyportlet.pt') def render(self): Render a named template or the default template. template = NamedTemplate(test.vocabulary) try: output = template(self) except ComponentLookupError: output = None # Even if the component lookup works, output can be None. if output is None: output = self.default_template() return output The line output = template(self) fails with a ComponentLookupError unless a named template with the name test.vocabulary exists. But when that template is found, output is still None. In case you want to see the entire code, this is in a Plone portlet that I am developing: http://svn.plone.org/svn/collective/collective.portlet.vocabulary/trunk/collective/portlet/vocabulary And actually, the tests that I added pass when I change the NamedTemplate.__call__ method to return the value that it just got. So should that method be changed or is there a different way to do this? Thanks, -- Maurits van Rees | http://maurits.vanrees.org/ Work | http://zestsoftware.nl/ This is your day, don't let them take it away. [Barlow Girl] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )