Changeset 3857 for waeup


Ignore:
Timestamp:
16 Jan 2009, 12:29:54 (16 years ago)
Author:
uli
Message:

Update tests.

File:
1 edited

Legend:

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

    r3833 r3857  
    3131
    3232  >>> u.name
    33   u'Unnamed'
     33  u'Sample University'
    3434
    3535Universities are basically also containers for faculties, students and
     
    4444  >>> u['hostels']
    4545  <waeup.hostel.hostelcontainer.HostelContainer object at 0x...>
     46
     47We can export universities. For this we lookup an appropriate exporter
     48first::
     49
     50  >>> from waeup.interfaces import IWAeUPExporter
     51  >>> exporter = IWAeUPExporter(u)
     52  >>> exporter
     53  <waeup.utils.importexport.Exporter object at 0x...>
     54
     55Now we can trigger the export::
     56
     57  >>> exporter.export(u)
     58  <cStringIO.StringO object at 0x...>
     59
     60We can also get an XML representation as file. If we do not provide a
     61filepath, we will get an instance of `cStringIO.StringIO`, i.e. a
     62memory file::
     63
     64  >>> from waeup.interfaces import IWAeUPXMLExporter
     65  >>> exporter = IWAeUPXMLExporter(u)
     66  >>> f = exporter.export(u)
     67  >>> f
     68  <cStringIO.StringO object at 0x...>
     69
     70  >>> print f.read()
     71  <?xml version="1.0" encoding="UTF-8"?>
     72  <waeupdata>
     73        <object type="waeup.app.University">
     74                <attribute name="name" type="unicode">
     75                        Sample University
     76                </attribute>
     77        </object>
     78  </waeupdata>
     79
     80
    4681
    4782Faculties
Note: See TracChangeset for help on using the changeset viewer.