Ignore:
Timestamp:
13 Oct 2011, 09:20:15 (13 years ago)
Author:
uli
Message:

Remove legacy stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.custom/trunk/src/waeup/custom/README.txt

    r6622 r6890  
    1 The waeup.sirp package
    2 **********************
     1The waeup.custom package
     2************************
    33
    4 .. :doctest:
    5 .. :layer: waeup.sirp.testing.WAeUPSIRPUnitTestLayer
    6 
    7 A portal software for student registration.
    8 
    9 Universities
    10 ============
    11 
    12 ``University`` objects are the base of all functionality provided by
    13 this package.  They contain all facilities of a university.
    14 
    15 We can easily create universities::
    16 
    17   >>> from waeup.sirp.app import University
    18   >>> u = University()
    19   >>> u
    20   <waeup.sirp.app.University object at 0x...>
    21 
    22 Universities have a name.
    23 
    24   >>> u.name
    25   u'Sample University'
    26 
    27 Universities are basically also containers for faculties, students and
    28 hostels::
    29 
    30   >>> u['faculties']
    31   <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...>
    32 
    33   >>> u['students']
    34   <waeup.sirp.students.container.StudentsContainer object at 0x...>
    35 
    36 We can export universities. For this we lookup an appropriate exporter
    37 first::
    38 
    39   >>> from waeup.sirp.interfaces import IWAeUPExporter
    40   >>> exporter = IWAeUPExporter(u)
    41   >>> exporter
    42   <waeup.sirp.utils.importexport.Exporter object at 0x...>
    43 
    44 Now we can trigger the export::
    45 
    46   >>> exporter.export()
    47   <cStringIO.StringO object at 0x...>
    48 
    49 We can also get an XML representation as file. If we do not provide a
    50 filepath, we will get an instance of `cStringIO.StringIO`, i.e. a
    51 memory file::
    52 
    53   >>> from waeup.sirp.interfaces import IWAeUPXMLExporter
    54   >>> exporter = IWAeUPXMLExporter(u)
    55   >>> f = exporter.export()
    56   >>> f
    57   <cStringIO.StringO object at 0x...>
    58 
    59   >>> print f.read()
    60   <?xml version="1.0" encoding="utf-8" ?>
    61   <pickle>
    62     <initialized_object id="...">
    63   ...
    64   </pickle>
    65 
    66 
    67 Faculties
    68 =========
    69 
    70 Faculties are containers for departments. They are intended to be
    71 managed by universities.
    72 
    73 We can create faculties easily::
    74 
    75   >>> from waeup.sirp.university.faculty import Faculty
    76   >>> f = Faculty()
    77   >>> f
    78   <waeup.sirp.university.faculty.Faculty object at 0x...>
    79 
    80 Also faculties want to be named::
    81 
    82   >>> f.title
    83   u'Unnamed Faculty'
    84 
    85 Departments
    86 ===========
    87 
    88 
    89 WAeUP SIRP plugins
    90 ==================
    91 
    92 waeup.sirp provides an API to 'plugin' components. Things that should
    93 be setup at creation time of a WAeUP SIRP application can indicate
    94 that by providing a utility providing IWAeUPSIRPPlugin.
    95 
    96 The plugins are looked up by an created app, which then will call the
    97 ``setup()`` method of each plugin.
    98 
    99    >>> from waeup.sirp.interfaces import IWAeUPSIRPPluggable
    100    >>> from zope.component import getAdapters, getUtilitiesFor
    101    >>> sorted(list(getUtilitiesFor(IWAeUPSIRPPluggable)))
    102    [(u'accesscodes', <waeup.sirp.accesscodes...AccessCodePlugin ...)]
    103 
    104 
    105 We can provide a new plugin like this:
    106 
    107    >>> import grok
    108    >>> from waeup.sirp.interfaces import IWAeUPSIRPPluggable
    109    >>> class MyPlugin(grok.GlobalUtility):
    110    ...   grok.implements(IWAeUPSIRPPluggable)
    111    ...   def setup(self, site, name, logger):
    112    ...     print "Setup was called for"
    113    ...     print site
    114    ...   def update(self, site, name, logger):
    115    ...     pass
    116 
    117 When we register the plugin
    118 
    119    >>> grok.testing.grok_component('MyPlugin', MyPlugin)
    120    True
    121 
    122 and setup a new WAeUP SIRP instance, we will get a message:
    123 
    124    >>> from waeup.sirp.app import University
    125    >>> site = University()
    126    Setup was called for
    127    <waeup.sirp.app.University object at 0x...>
    128 
    129 Apparently the plugin can do with the University object whatever it
    130 likes. That's what plugins are for.
     4A customized portal software for student registration.
Note: See TracChangeset for help on using the changeset viewer.