|
Revision 10897, 1.2 kB
(checked in by atchertchian, 6 years ago)
|
adding IOBase type to take care of logs
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
# (C) Copyright 2004 Nuxeo SARL <http://nuxeo.com> |
|---|
| 2 |
# Author: Emmanuel Pietriga <ep@nuxeo.com> |
|---|
| 3 |
# |
|---|
| 4 |
# This program is free software; you can redistribute it and/or modify |
|---|
| 5 |
# it under the terms of the GNU General Public License version 2 as published |
|---|
| 6 |
# by the Free Software Foundation. |
|---|
| 7 |
# |
|---|
| 8 |
# This program is distributed in the hope that it will be useful, |
|---|
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 |
# GNU General Public License for more details. |
|---|
| 12 |
# |
|---|
| 13 |
# You should have received a copy of the GNU General Public License |
|---|
| 14 |
# along with this program; if not, write to the Free Software |
|---|
| 15 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
|---|
| 16 |
# 02111-1307, USA. |
|---|
| 17 |
# |
|---|
| 18 |
# $Id$ |
|---|
| 19 |
|
|---|
| 20 |
from zLOG import LOG, DEBUG, INFO, WARNING, ERROR |
|---|
| 21 |
|
|---|
| 22 |
class IOBase: |
|---|
| 23 |
"""IOBase: base for importers and exporters |
|---|
| 24 |
|
|---|
| 25 |
Used to keep logs while import/export |
|---|
| 26 |
""" |
|---|
| 27 |
|
|---|
| 28 |
messages = [] |
|---|
| 29 |
|
|---|
| 30 |
# |
|---|
| 31 |
# Logging |
|---|
| 32 |
# |
|---|
| 33 |
def log(self, message): |
|---|
| 34 |
self.messages.append(message) |
|---|
| 35 |
|
|---|
| 36 |
def flush(self): |
|---|
| 37 |
log = '\n'.join(self.messages) |
|---|
| 38 |
self.messages = [] |
|---|
| 39 |
return log |
|---|
| 40 |
|
|---|
| 41 |
def logResult(self): |
|---|
| 42 |
truc = self.flush() |
|---|
| 43 |
return truc |
|---|