Ignore:
Timestamp:
1 Apr 2009, 16:26:54 (16 years ago)
Author:
uli
Message:

Make importexport-API more consistent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/utils/importexport.py

    r3932 r4040  
    107107        else:
    108108            filelike_obj = open(filepath, 'wb')
    109         filelike_obj.write(result.toprettyxml(encoding='UTF-8'))
     109        filelike_obj.write(result.toxml(encoding='UTF-8'))
    110110        filelike_obj.seek(0)
    111111        self.cleanUp()
    112112        return filelike_obj
    113113
    114     def exportPrettyXML(self, obj):
     114    def exportPrettyXML(self, obj, filepath=None):
    115115        result = self._export(obj).toprettyxml(encoding='UTF-8')
     116        if filepath is None:
     117            filelike_obj = StringIO()
     118        else:
     119            filelike_obj = open(filepath, 'wb')
     120        filelike_obj.write(result)
     121        filelike_obj.seek(0)
    116122        self.cleanUp()
    117         return result
     123        return filelike_obj
Note: See TracChangeset for help on using the changeset viewer.