Ignore:
Timestamp:
2 Apr 2009, 11:05:28 (16 years ago)
Author:
uli
Message:

Update tests.

Location:
waeup/branches/ulif-rewrite/src/waeup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/README.txt

    r4041 r4046  
    6969
    7070  >>> print f.read()
    71   <?xml version="1.0" encoding="UTF-8"?>...
    72 
     71  <?xml version="1.0" encoding="utf-8" ?>
     72  <pickle>
     73    <initialized_object>
     74  ...
     75  </pickle>
    7376
    7477
  • waeup/branches/ulif-rewrite/src/waeup/utils/importexport.txt

    r4042 r4046  
    2424One of the major formats we support for data export is XML.
    2525
    26 When we want to export an object, we can choose the kind of XML to
    27 generate (plain or pretty) and the destination file. If we do not give
    28 a file to write to, we get a StringIO object, i.e. an in-memory file.
     26When we want to export an object, we can choose the destination
     27file. If we do not give a file to write to, we get a StringIO object,
     28i.e. an in-memory file.
    2929
    3030To show this basic functionality provided for all XML exportable
     
    5656
    5757    >>> print result.read()
    58     <?xml version="1.0" encoding="UTF-8"?>...
     58    <?xml version="1.0" encoding="utf-8" ?>...
    5959
    60 
    61 Exporting pretty XML
    62 --------------------
    63 
    64 As the result is one long string (which is necessary to preserve
    65 linebreaks), it is not very good readable. This special exporter
    66 however, can also provide ``pretty XML``::
    67 
    68     >>> print exporter.exportPrettyXML(myfaculty).read()
    69     <?xml version="1.0" encoding="UTF-8"?>
    70     <waeupdata>
    71         <object type="waeup.university.faculty.Faculty">
    72                 <attribute name="name" type="str">
    73                         My very faculty.
    74                 </attribute>
    75         </object>
    76     </waeupdata>
    7760
    7861Generating XML files
    7962--------------------
    8063
    81 Both methods (`export` and `exportPrettyXML`) support writing the
    82 results to a file::
     64We can also let the results be written to a file::
    8365
    8466    >>> result = exporter.export(myfaculty, 'myexport.xml')
    8567    >>> print open('myexport.xml', 'rb').read()
    86     <?xml version="1.0" encoding="UTF-8"?>...
    87 
    88 We can also let the exporter format the output prettier::
    89 
    90     >>> result = exporter.exportPrettyXML(myfaculty, 'myexport.xml')
    91     >>> print open('myexport.xml', 'rb').read()
    92     <?xml version="1.0" encoding="UTF-8"?>
    93     <waeupdata>
    94         <object type="waeup.university.faculty.Faculty">
    95                 <attribute name="name" type="str">
    96                         My very faculty.
    97                 </attribute>
    98         </object>
    99     </waeupdata>
     68    <?xml version="1.0" encoding="utf-8" ?>
     69    <pickle>
     70      <initialized_object>
     71    ...
     72    </pickle>
    10073
    10174Clean up::
Note: See TracChangeset for help on using the changeset viewer.