Re: [Zope3-dev] Re: 'layer' vs. 'type'

2006-09-18 Thread Gustavo Niemeyer
 I wasn't sure about the layer to type renaming myself. Plus, it
 would've been one of those janitorial changes that just weren't
 worth it.  That's why I didn't do it.

It looks like the process has already started.  Should things
like these be reverted then (zope.app.component.metadirectives):


  class IBasicResourceInformation(zope.interface.Interface):
  
  Basic information for resources
  

(...)
 
type = zope.configuration.fields.GlobalInterface(
title=_(Request type),
required=True
)

  (...)

  class IResourceDirective(IBasicComponentInformation,
   IBasicResourceInformation):
  Register a resource
  
  # BBB 2006/02/18, to be removed after 12 months
  layer = LayerField(
  title=_(The layer the resource is in.  This argument has been 
  deprecated and will be removed in Zope 3.5.  Use the 
  'type' argument instead.),
  required=False,
  )

  (...)

  class IBasicViewInformation(zope.interface.Interface):
  This is the basic information for all views.

(...)

# BBB 2006/02/18, to be removed after 12 months
layer = LayerField(
title=_(The layer the view is in.),
description=_(
*BBB: DEPRECATED*

A skin is composed of layers. It is common to put skin
specific views in a layer named after the skin. If the 'layer'
attribute is not supplied, it defaults to 'default'.),
required=False,
)


-- 
Gustavo Niemeyer
http://niemeyer.net
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Patching zope.testing

2006-09-05 Thread Gustavo Niemeyer
Hello folks,

I'd change slightly the output format of the log handler in
zope.testing.loggingsupport so that one is able to see *what*
went wrong when an exception is logged.  For instance, rather
than getting just:

zope.app.generations ERROR
  Failed to evolve database to generation 4 for app1

One would get:

zope.app.generations ERROR
  Failed to evolve database to generation 4 for app1
  Traceback (most recent call last):
  ...
  ValueError: 4

Even though this is a simple change, it'll break a few tests in
the Zope 3 tree, and perhaps other projects using the same test
runner (is anyone else using it?).

With this in mind, and considering that I haven't been following
the development as closely as I should, I'd like to check with you
if it's ok to apply the change at this point to the trunk of
zope.testing and update the svn:external link of Zope3 trunk while
fixing the broken tests, or if there's another less disruptive way
of doing it.

The patch is the following one. Notice that in addition to introduce
backtraces, it'll also indent all lines to 2 spaces, rather than just
the first one (so that all of them are identified as pertaining to
the given log message).


Index: loggingsupport.py
===
--- loggingsupport.py   (revision 69092)
+++ loggingsupport.py   (working copy)
@@ -105,16 +105,16 @@
 logger.removeHandler(self)

 def __str__(self):
-return '\n'.join(
-[(%s %s\n  %s %
-  (record.name, record.levelname,
-   '\n'.join([line
-  for line in record.getMessage().split('\n')
-  if line.strip()])
-   )
-  )
-  for record in self.records]
-  )
+lines = []
+for record in self.records:
+lines.append(%s %s % (record.name, record.levelname))
+for line in record.getMessage().split(\n):
+if line.strip():
+lines.append(  +line)
+if record.exc_info and record.exc_info[0] and record.exc_text:
+for line in record.exc_text.split(\n):
+lines.append(  +line)
+return '\n'.join(lines)


 class InstalledHandler(Handler):



-- 
Gustavo Niemeyer
http://niemeyer.net
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Patching zope.testing

2006-09-05 Thread Gustavo Niemeyer
 I agree.  zope.testing.loggingsupport is for testing logging, not for
 logging while testing. :)

Can you do one without the other? :-)

Please check my answer to Fred.

-- 
Gustavo Niemeyer
http://niemeyer.net
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Patching zope.testing

2006-09-05 Thread Gustavo Niemeyer
 I agree.  zope.testing.loggingsupport is for testing logging, not for
 logging while testing. :)

Can you do one without the other? :-)

Please check my answer to Fred.

-- 
Gustavo Niemeyer
http://niemeyer.net
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com