source: main/waeup.sirp/trunk/src/waeup/sirp/README.txt @ 4990

Last change on this file since 4990 was 4920, checked in by uli, 15 years ago

Make unit tests run again with the new package layout.

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1The waeup.sirp package
2**********************
3
4:Test-Layer: unit
5
6A portal software for student registration.
7
8Prerequisites
9=============
10
11Before we can work with the environment, we have to register all the
12utilities, adapters, etc. We grok the `waeup` package to do that::
13
14  >>> import grok
15  >>> grok.testing.grok('waeup.sirp')
16
17Universities
18============
19
20``University`` objects are the base of all functionality provided by
21this package.  They contain all facilities of a university.
22
23We can easily create universities::
24
25  >>> from waeup.sirp.app import University
26  >>> u = University()
27  >>> u
28  <waeup.sirp.app.University object at 0x...>
29
30Universities have a name.
31
32  >>> u.name
33  u'Sample University'
34
35Universities are basically also containers for faculties, students and
36hostels::
37
38  >>> u['faculties']
39  <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...>
40
41  >>> u['students']
42  <waeup.sirp.student.studentcontainer.StudentContainer object at 0x...>
43
44  >>> u['hostels']
45  <waeup.sirp.hostel.hostelcontainer.HostelContainer object at 0x...>
46
47We can export universities. For this we lookup an appropriate exporter
48first::
49
50  >>> from waeup.sirp.interfaces import IWAeUPExporter
51  >>> exporter = IWAeUPExporter(u)
52  >>> exporter
53  <waeup.sirp.utils.importexport.Exporter object at 0x...>
54
55Now we can trigger the export::
56
57  >>> exporter.export()
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.sirp.interfaces import IWAeUPXMLExporter
65  >>> exporter = IWAeUPXMLExporter(u)
66  >>> f = exporter.export()
67  >>> f
68  <cStringIO.StringO object at 0x...>
69
70  >>> print f.read()
71  <?xml version="1.0" encoding="utf-8" ?>
72  <pickle>
73    <initialized_object id="...">
74  ...
75  </pickle>
76
77
78Faculties
79=========
80
81Faculties are containers for departments. They are intended to be
82managed by universities.
83
84We can create faculties easily::
85
86  >>> from waeup.sirp.university.faculty import Faculty
87  >>> f = Faculty()
88  >>> f
89  <waeup.sirp.university.faculty.Faculty object at 0x...>
90
91Also faculties want to be named::
92
93  >>> f.title
94  u'Unnamed Faculty'
95
96Departments
97===========
98
Note: See TracBrowser for help on using the repository browser.