[schooltool-dev] External Activities

Tom Hoffman tom.hoffman at gmail.com
Tue Dec 16 08:32:16 EST 2008


This seems right to me so far.

--Tom

On Mon, Dec 15, 2008 at 11:29 PM, Douglas Cerna <douglascerna at yahoo.com> wrote:
> 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
>
>
>
> _______________________________________________
> Schooltool-dev mailing list
> Schooltool-dev at schooltool.org
> http://lists.schooltool.org/mailman/listinfo/schooltool-dev
>
>


More information about the Schooltool-dev mailing list