Hi Tres!

Tres Seaver wrote:
Hmm, it seems like that landed in the project-local repository from
which GenericSetup originally sprang, but *after* GenericSetup landed in
CMF's repository.  I'm attaching the patch:

  - It uses the '_notes' field both to create an OFS.Image.File log of
    import runs, as well as to display at the bottom of the "Import"

  - It echoes logged messages to zLOG.

  - It expands ISetupContext's API with methods 'note', 'listNotes',
    and 'clearNotes'.  Stock implementations of ths API are in a new
    'SetupContextBase' class.

Note that the patch doesn't apply cleanly to the GenericSetup trunk;
I'll have to work out why if we chose to land it.

OK, I've landed it (it was easier than I expected) on a new branch:


I tried hard to make the I/O adapters reusable outside GenericSetup. To become more independent from ISetupContext I propose to move the logging API into a separate interface and class. ISetupContext would just have a getLogger() method.

I'm also missing different logging levels. The python logging module has a nice generic API for that.

So I propose to use the same interface for the GenericSetup specific logger, making it replaceable by a python logger if the I/O handlers are used in a different context.

For example this code in content.py::

                        'no .ini file for %s/%s' % (subdir, cid))

would be replaced by this code::

    logger = import_context.getLogger('SGAIFA')
    logger.info('no .ini file for %s/%s' % (subdir, cid))

If there are no objections I'd like to make those changes either on your branch or after you merged your changes into the trunk.



Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to