Changeset 4326


Ignore:
Timestamp:
21 Jun 2009, 00:05:38 (16 years ago)
Author:
uli
Message:

Make dept docs sphinx-aware.

File:
1 edited

Legend:

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

    r4258 r4326  
    1 Departments
    2 ***********
     1:mod:`waeup.university.department` -- Departments
     2*************************************************
     3
     4.. module:: waeup.university.department
     5
     6Components that represent university departments.
    37
    48:Test-Layer: unit
    59
    6 Creating departments
    7 ====================
    8 
    9 Before we can create departments, we have to grok the `waeup`
     10Before we can create departments, we have to grok the :mod:`waeup`
    1011package. This happens automatically in real-world use:
    1112
     
    1314    >>> grok.testing.grok('waeup')
    1415
    15 We can create departments:
    1616
    17     >>> from waeup.university.department import Department
    18     >>> mydept = Department()
    19     >>> mydept
    20     <waeup.university.department.Department object at 0x...>
     17Content Classes (models and containers)
     18=======================================
    2119
    22 Another way to create departments is by asking for a factory called
    23 ``waeup.Department``. This way we can create a department without
    24 importing a class:
    2520
    26     >>> from zope.component import createObject
    27     >>> mydept = createObject(u'waeup.Department')
    28     >>> mydept
    29     <waeup.university.department.Department object at 0x...>
     21:class:`Department`
     22-------------------
    3023
    31 Department attributes
    32 =====================
     24.. class:: Department(title=u'Unnamed Department'[, title_prefix=u'department' [, code=u"NA"]])
    3325
    34 Departments have the attributes required by the `IDepartment` interface:
     26   Create a representation of a university department:
    3527
    36     >>> from waeup.interfaces import IDepartment
    37     >>> IDepartment.providedBy(mydept)
    38     True
     28     >>> from waeup.university.department import Department
     29     >>> mydept = Department()
     30     >>> mydept
     31     <waeup.university.department.Department object at 0x...>
    3932
    40     >>> from zope.interface.verify import verifyObject
    41     >>> verifyObject(IDepartment, mydept)
    42     True
     33   Another way to create :class:`Department` instances is by asking
     34   for a factory called ``waeup.Department``. This way we can create a
     35   department without importing a class:
    4336
    44 Each of the following attributes is mandatory.
     37     >>> from zope.component import createObject
     38     >>> mydept = createObject(u'waeup.Department')
     39     >>> mydept
     40     <waeup.university.department.Department object at 0x...>
    4541
    46 `title`
    47 -------
     42   :class:`Department` instances have the attributes required by the
     43   `IDepartment` interface:
    4844
    49 Each department has a title:
     45     >>> from waeup.interfaces import IDepartment
     46     >>> IDepartment.providedBy(mydept)
     47     True
    5048
    51     >>> mydept.title
    52     u'Unnamed Department'
     49     >>> from zope.interface.verify import verifyObject
     50     >>> verifyObject(IDepartment, mydept)
     51     True
    5352
    54 `title_prefix`
    55 --------------
    5653
    57 Each department has a title prefix, which specifies the kind of
    58 institution:
     54   .. attribute:: title
    5955
    60     >>> mydept.title_prefix
    61     u'department'
     56      (string) The title of a department.
    6257
    63 `code`
    64 ------
     58      Each department has a title:
    6559
    66 Each department holds a code, which might be a shortcut or
    67 abbreviation of the real department name. By default the code is ``NA``
    68 (=not assigned):
     60        >>> mydept.title
     61        u'Unnamed Department'
    6962
    70     >>> mydept.code
    71     u'NA'
    7263
    73 `courses`
    74 ---------
     64   .. attribute:: title_prefix
    7565
    76 Each department has a courses container:
     66      (string) The prefix of a department.
    7767
    78     >>> mydept.courses
    79     <waeup.university.coursecontainer.CourseContainer object at 0x...>
     68      Each department has a title prefix, which specifies the kind of
     69      institution:
     70
     71        >>> mydept.title_prefix
     72        u'department'
     73
     74
     75   .. attribute:: code
     76
     77      (string) An internally used unique code string.
     78
     79      Each department holds a code, which might be a shortcut or
     80      abbreviation of the real department name. By default the code is
     81      ``NA`` (=not assigned):
     82
     83        >>> mydept.code
     84        u'NA'
     85
     86
     87   .. attribute:: courses
     88
     89      (ICourseContainer instance) A container for courses.
     90
     91      Each department has a courses container:
     92
     93        >>> mydept.courses
     94        <waeup.university.coursecontainer.CourseContainer object at 0x...>
     95
Note: See TracChangeset for help on using the changeset viewer.