[schooltool-dev] External Activities

Douglas Cerna douglascerna at yahoo.com
Tue Dec 16 02:29:38 EST 2008


Hi everybody.

I'm working on external activities for the schooltool.gradebook package. After talking to Ignas and Alan, here's the basic design I came up with (I attach a diff with tests passing using only stubs). I'd appreciate some feedback on it please.

***********************************

External Activities
-------------------

External Activities allow other schooltool modules to provide grades
that can be used in worksheets.

This will make possible, for example, to integrate CanDo skilldrivers
(or assignments) grades into the schooltool gradebook.

The schooltool gradebook has an adapter to get a list with all the
external activities registered by other modules::

    >>> ext_act = interfaces.IExternalActivities(sectionA)
    >>> ext_act
    [<ExternalActivity...>, <ExternalActivity...>,
     <ExternalActivity...>, <ExternalActivity...>]

In order to integrate with the schooltool gradebook, the external
module must register a named utility that provides the
IExternalActivities interface::

    >>> from zope.component import getUtilitiesFor, getUtility
    >>> sorted(list(getUtilitiesFor(interfaces.IExternalActivitiesUtility)))
    [(u'someproduct', <ExternalActivitiesUtility...>),
     (u'thirdparty', <ExternalActivitiesUtility...>)]

These utilities must have a ``getExternalActivities(section)`` method
that returns a list of IExternalActivity objects::

    >>> someproduct = getUtility(interfaces.IExternalActivitiesUtility,
    ...                          name=u"someproduct")
    >>> someproduct.getExternalActivities(sectionA)
    [<ExternalActivity...>]
    >>> thirdparty = getUtility(interfaces.IExternalActivitiesUtility,
    ...                         name=u"thirdparty")
    >>> thirdparty.getExternalActivities(sectionA)
    [<ExternalActivity...>, <ExternalActivity...>,
     <ExternalActivity...>]

Finally, each IExternalActivity object provides a
``getGrade(student)`` method that return an integer percentage for the
given student::

    >>> someproduct.getExternalActivities(sectionA)[0].getGrade(paul)
    50

If the student doesn't have a grade for that external activity, None
should be returned::

    >>> thirdparty.getExternalActivities(sectionA)[1].getGrade(paul)

***********************************

Thanks, Douglas

"... allí­ es cuando te das cuenta que las cosas malas pueden resultar bastante buenas..." - Lionel Messi

Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
Vea http://www.gnu.org/philosophy/no-word-attachments.es.html


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: external_activities.diff
Type: text/x-patch
Size: 6656 bytes
Desc: not available
Url : http://lists.schooltool.org/pipermail/schooltool-dev/attachments/20081215/87e7ab46/attachment.bin 


More information about the Schooltool-dev mailing list