- Timestamp:
- 16 Jan 2009, 12:29:54 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/README.txt
r3833 r3857 31 31 32 32 >>> u.name 33 u' Unnamed'33 u'Sample University' 34 34 35 35 Universities are basically also containers for faculties, students and … … 44 44 >>> u['hostels'] 45 45 <waeup.hostel.hostelcontainer.HostelContainer object at 0x...> 46 47 We can export universities. For this we lookup an appropriate exporter 48 first:: 49 50 >>> from waeup.interfaces import IWAeUPExporter 51 >>> exporter = IWAeUPExporter(u) 52 >>> exporter 53 <waeup.utils.importexport.Exporter object at 0x...> 54 55 Now we can trigger the export:: 56 57 >>> exporter.export(u) 58 <cStringIO.StringO object at 0x...> 59 60 We can also get an XML representation as file. If we do not provide a 61 filepath, we will get an instance of `cStringIO.StringIO`, i.e. a 62 memory 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 46 81 47 82 Faculties
Note: See TracChangeset for help on using the changeset viewer.