[Zope-Checkins] SVN: Zope/trunk/ - RESPONSE.handle_errors was wrongly set (to debug, should have been

2009-05-08 Thread Sidnei da Silva
Log message for revision 99805:
  - RESPONSE.handle_errors was wrongly set (to debug, should have been
``not debug``). Also, the check for exception constructor arguments
didn't account for exceptions that didn't override the ``__init__``
(which are most of them). The combination of those two problems
caused the ``standard_error_message`` not to be called. Fixes
https://bugs.edge.launchpad.net/zope2/+bug/372632 .
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/OFS/SimpleItem.py
  U   Zope/trunk/src/OFS/tests/testSimpleItem.py
  U   Zope/trunk/src/ZPublisher/Publish.py
  U   Zope/trunk/src/ZPublisher/Test.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===
--- Zope/trunk/doc/CHANGES.rst  2009-05-07 19:07:21 UTC (rev 99804)
+++ Zope/trunk/doc/CHANGES.rst  2009-05-07 23:18:39 UTC (rev 99805)
@@ -36,6 +36,13 @@
 Bugs Fixed
 ++
 
+- RESPONSE.handle_errors was wrongly set (to debug, should have been
+  ``not debug``). Also, the check for exception constructor arguments
+  didn't account for exceptions that didn't override the ``__init__``
+  (which are most of them). The combination of those two problems
+  caused the ``standard_error_message`` not to be called. Fixes
+  https://bugs.edge.launchpad.net/zope2/+bug/372632 .
+
 - DocumentTemplate.DT_Raise:  use new 'zExceptions.convertExceptionType'
   API to allow raising non-builtin exceptions.
   Fixes https://bugs.launchpad.net/zope2/+bug/372629 , which prevented
@@ -50,7 +57,7 @@
 Bugs Fixed
 ++
 
-- fixed versions.cfg in order to support zope.z2release for 
+- fixed versions.cfg in order to support zope.z2release for
   creating a proper index structure
 
 2.12.0a3 (2009-04-19)

Modified: Zope/trunk/src/OFS/SimpleItem.py
===
--- Zope/trunk/src/OFS/SimpleItem.py2009-05-07 19:07:21 UTC (rev 99804)
+++ Zope/trunk/src/OFS/SimpleItem.py2009-05-07 23:18:39 UTC (rev 99805)
@@ -237,15 +237,24 @@
 if not REQUEST:
 REQUEST = aq_acquire(self, 'REQUEST')
 
-handle_errors = getattr(getattr(REQUEST, 'RESPONSE', None), 
+handle_errors = getattr(getattr(REQUEST, 'RESPONSE', None),
 'handle_errors', False)
 # Can we re-raise the exception with a rendered-to-HTML
 # exception value? To be able to do so, the exception
 # constructor needs to be able to take more than two
 # arguments (some Zope 3 exceptions can't).
-ctor = getattr(getattr(error_type, '__init__', None), 'im_func', 
None)
-can_raise = (ctor is not None and inspect.isfunction(ctor) 
- and len(inspect.getargspec(error_type.__init__)[0])  
2)
+ctor = getattr(error_type, '__init__', None)
+if inspect.ismethoddescriptor(ctor):
+# If it's a method descriptor, it means we've got a
+# base ``__init__`` method that was not overriden,
+# likely from the base ``Exception`` class.
+can_raise = True
+else:
+if inspect.ismethod(ctor):
+ctor = getattr(ctor, 'im_func', None)
+can_raise = (
+ctor is not None and inspect.isfunction(ctor)
+and len(inspect.getargspec(error_type.__init__)[0])  2)
 
 if not (can_raise and handle_errors):
 # If we have been asked not to handle errors and we

Modified: Zope/trunk/src/OFS/tests/testSimpleItem.py
===
--- Zope/trunk/src/OFS/tests/testSimpleItem.py  2009-05-07 19:07:21 UTC (rev 
99804)
+++ Zope/trunk/src/OFS/tests/testSimpleItem.py  2009-05-07 23:18:39 UTC (rev 
99805)
@@ -32,7 +32,36 @@
 
 verifyClass(ISimpleItem, SimpleItem)
 
+def test_standard_error_message_is_called(self):
+from zExceptions import BadRequest
+from OFS.SimpleItem import SimpleItem
 
+# handle_errors should default to True. It is a flag used for
+# functional doctests. See ZPublisher/Test.py and
+# ZPublisher/Publish.py.
+class REQUEST(object):
+class RESPONSE(object):
+handle_errors = True
+
+class StandardErrorMessage(object):
+def __init__(self):
+self.kw = {}
+
+def __call__(self, **kw):
+self.kw.clear()
+self.kw.update(kw)
+
+item = SimpleItem()
+item.standard_error_message = sem = StandardErrorMessage()
+
+try:
+raise BadRequest(1)
+except:
+item.raise_standardErrorMessage(client=item,
+REQUEST=REQUEST())
+
+self.assertEquals(sem.kw.get('error_type'), 'BadRequest')
+
 def test_suite():
 return 

Re: [Zope-dev] Using views for exceptions in Zope 2.12?

2009-05-08 Thread Hanno Schlichting
Chris Withers wrote:
 Given that the source of bug #372632 appears to be code related to 
 allowing views on exceptions in Zope 2, I thought I'd try use this method.

Try following the description given in the changelog at
http://svn.zope.org/Zope/branches/2.11/doc/CHANGES.txt?view=markup under
Zope 3-based exception views.

Hanno

___
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 )


[Zope-dev] Using views for exceptions in Zope 2.12?

2009-05-08 Thread Chris Withers
Hi All,

Given that the source of bug #372632 appears to be code related to 
allowing views on exceptions in Zope 2, I thought I'd try use this method.

I tried this, without much joy:

   browser:defaultView
   for=exceptions.Exception
   name=error
   /
   browser:page
   for=exceptions.Exception
   template=html/error.html
   name=error
   permission=zope2.Public
   /

So, how should I be wiring in views for exceptions?

Also, is there a base view class for exceptions anywhere that provides 
the following or their equivalents?

 kwargs = {'error_type': error_name,
   'error_value': error_value,
   'error_tb': error_tb,
   'error_traceback': error_tb,
   'error_message': error_message,
   'error_log_url': error_log_url}

Finally, when a view is used to render and exception, is the userthe 
current logged in user (as is the case with standard_error_message) or 
Anonymous (as has annoyingly been the case with Unauthorized exceptions 
in the past)

cheers,

Chris

-- 
Simplistix - Content Management, Zope  Python Consulting
- http://www.simplistix.co.uk
___
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 )


[Zope-dev] Publishing our company internal Zope extensions and fixes

2009-05-08 Thread Andreas Jung
Hi there,

we are currently combing through our company internal Zope (2.11) version
and trying to identify the stuff that is of interest for the public and the
Zope 2 core (including some ZODB extensions/changes). I will create a ticket
on Launchpad (containing a detailed description + patch)
for the interesting items (we have roughly 50 of them) over the next
days. All items are prefixed with [DM].
Everyone is invited to look at the stuff and
comment on it. I also reserve the right merging some of the changes into
the current
trunk until the next Zope 2.12 beta2 release (intentionally breaking the
rule
that no new features should be added within the beta phase).

Andreas
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:i...@zopyx.com
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
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 )


[Zope-dev] buildbot web page

2009-05-08 Thread Martijn Faassen
Hi there,

There are various buildbots running for Zope-related stuff. The problem 
is that they're only mentioned on mailing lists and such so nobody 
remembers where they are, how to use them, and who to contact.

Could someone work with Sebastien Douche who is maintaining one buildbot 
and record what's going on?

http://zope.buildbot.securactive.org/
http://grok.buildbot.securactive.org/
(missing repoze and zc.builout)

You can record it in a page in the zopetoolkit area in SVN.

If you're feeling ambitious you could also look into using snakebite for 
testing some of our packages on a large range of platforms.

Regards,

Martijn

P.S. I'm not in charge of the buildbot story. At all. I'm just trying to 
get others to take some responsibility in documenting it and promoting 
it. I'm not even a user really at this point. I want to be one, but I 
need a web page telling me where to go. :)

___
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] buildbot web page

2009-05-08 Thread Marius Gedminas
On Fri, May 08, 2009 at 11:52:43AM +0200, Martijn Faassen wrote:
 There are various buildbots running for Zope-related stuff. The problem 
 is that they're only mentioned on mailing lists and such so nobody 
 remembers where they are, how to use them, and who to contact.
 
 Could someone work with Sebastien Douche who is maintaining one buildbot 
 and record what's going on?
 
 http://zope.buildbot.securactive.org/
 http://grok.buildbot.securactive.org/
 (missing repoze and zc.builout)
 
 You can record it in a page in the zopetoolkit area in SVN.

http://zope3.pov.lt/buildbot (the Zope 3.4 KGS buildbot) is already
mentioned there, in ./source/process/tools.rst

Incidentally, I spent some time yesterday fiddling with the look and
feel, after the relatively recent upgrade of buildbot to 0.7.8.  Also,
both build slaves now run the same OS version: Ubuntu 8.04, the
difference now is architecture: i386 vs x86_64.

 P.S. I'm not in charge of the buildbot story. At all. I'm just trying to 
 get others to take some responsibility in documenting it and promoting 
 it. I'm not even a user really at this point. I want to be one, but I 
 need a web page telling me where to go. :)

Where is the site maintained in zopetoolkit going to live on the web?

(You can tell I've been skipping some of the threads lately.)

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development


signature.asc
Description: Digital signature
___
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 )


[Zope-dev] Zope Tests: 6 OK, 2 Failed

2009-05-08 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Thu May  7 12:00:00 2009 UTC to Fri May  8 12:00:00 2009 UTC.
There were 8 messages: 8 from Zope Tests.


Test failures
-

Subject: FAILED (errors=1) : Zope-trunk Python-2.4.6 : Linux
From: Zope Tests
Date: Thu May  7 20:49:20 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011653.html

Subject: FAILED (errors=1) : Zope-trunk-alltests Python-2.4.6 : Linux
From: Zope Tests
Date: Thu May  7 20:55:25 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011656.html


Tests passed OK
---

Subject: OK : Zope-2.10 Python-2.4.6 : Linux
From: Zope Tests
Date: Thu May  7 20:45:16 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011651.html

Subject: OK : Zope-2.11 Python-2.4.6 : Linux
From: Zope Tests
Date: Thu May  7 20:47:20 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011652.html

Subject: OK : Zope-trunk Python-2.5.4 : Linux
From: Zope Tests
Date: Thu May  7 20:51:23 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011654.html

Subject: OK : Zope-trunk Python-2.6.1 : Linux
From: Zope Tests
Date: Thu May  7 20:53:25 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011655.html

Subject: OK : Zope-trunk-alltests Python-2.5.4 : Linux
From: Zope Tests
Date: Thu May  7 20:57:26 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011657.html

Subject: OK : Zope-trunk-alltests Python-2.6.1 : Linux
From: Zope Tests
Date: Thu May  7 20:59:27 EDT 2009
URL: http://mail.zope.org/pipermail/zope-tests/2009-May/011658.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] Publishing our company internal Zope extensions and fixes

2009-05-08 Thread Sidnei da Silva
On Fri, May 8, 2009 at 6:39 AM, Andreas Jung li...@zopyx.com wrote:
 Hi there,

 we are currently combing through our company internal Zope (2.11) version
 and trying to identify the stuff that is of interest for the public and the
 Zope 2 core (including some ZODB extensions/changes). I will create a ticket
 on Launchpad (containing a detailed description + patch)
 for the interesting items (we have roughly 50 of them) over the next
 days. All items are prefixed with [DM].
 Everyone is invited to look at the stuff and
 comment on it. I also reserve the right merging some of the changes into
 the current
 trunk until the next Zope 2.12 beta2 release (intentionally breaking the
 rule
 that no new features should be added within the beta phase).

I've found the [DM] prefix to be very annoying. You could have used
tags instead.

Regardless of that, thanks for putting those improvements out there.
I've looked at the list and at least a couple of them are very
interesting to me.

-- 
Sidnei da Silva
Canonical Ltd.
 Landscape · Changing the way you manage your systems
http://landscape.canonical.com
___
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] Publishing our company internal Zope extensions and fixes

2009-05-08 Thread Andreas Jung
On 08.05.09 15:24, Sidnei da Silva wrote:
 You could have used
 tags instead.
   

I did not know that LP provides tagging support (in fact I hate tags :-))

Andreas
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:i...@zopyx.com
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
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] zc.buildout broken

2009-05-08 Thread Sebastien Douche
On Fri, Apr 24, 2009 at 16:28, Jim Fulton j...@zope.com wrote:
 Do you want a buildbot for zc.buildout? (py2.4, py2.5, py2.6 on linux
 3264, sorry)


 +1

Done:
http://misc.buildbot.securactive.org/waterfall
(sorry, 32 bit slave is down)



-- 
Sebastien Douche sdou...@gmail.com
___
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 )


[Zope] searching for a perfect way to integrate toscawidgets in a zope product.

2009-05-08 Thread Krishnakant
hello all,
While I am doing good with grok after some reading now, I have another
problem.

Looking at the features of toscawidgets,  am tempted to have it on top
of zope (grok).

I searched but did not find any proper tutorial or article for doing
this.

Has any one on the mailing list tryed this?

happy hacking.
Krishnakant.



___
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] z3c.form - custom terms for a radio widget

2009-05-08 Thread Dan Fairs
Hi,

I'm trying to override the default terms for a radio widget on a Bool  
field. My schema and form are as follows:

class IBookingForm(Interface):
 agree_tc = Bool(
 title=uBooking Terms and Conditions,
 )

class BookingForm(AddForm):
 fields = field.Fields(IBookingForm)

So, pretty straightforward. This renders out with 'yes' and 'no' as  
the values. I'd like this to display as 'I agree' and 'I don't agree'.

The docs say that you should provide an alternate set of terms to  
change the labels, so I have this class:

class TandCBoolTerms(term.BoolTerms):
   trueLabel = uI Agree
   falseLabel = uI Don't Agree

However, I'm now slightly at a loss as to how to register this terms  
class for that single field on the form - the docs don't mention that!  
Looking at the code, I can see the multi-adapter lookup in  
z3c.form.widget.SelectWidget.updateTerms(), which looks like what I  
want. Is there some kind of discriminator I can use (like the  
StaticWidgetAttribute class) to help with this registration?

Thanks,
Dan
--
Dan Fairs dan.fa...@gmail.com | http://www.fezconsulting.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] bug? pagetemplate using strftime

2009-05-08 Thread Miguel Beltran R.



 You can't use stftime.
 You have to manually build a string with the format you want using the
 other methods inside DateTime.

 e.g. fetcha.aCommonZ() or build up your date using
 components such as; fetcha.day()  fetcha.month()  fetcha.year()



I made a script what recive a parameter fecha(f)
script pFecha:
s=%02d-%02d-%04d
s=s % (f.day(),f.month(),f.year())
print s
return printed


the call is td tal:content=python: container/pFecha(item.fecha)

Thanks
___
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 )