\chapter{Directives}

The \module{grok} module defines a set of directives that allow you to
configure and register your components. Most directives assume a default, based
on the environment of a module. (For example, a view will be automatically
associated with a model if the association can be made unambigously.)

If no default can be assumed for a value, grok will explicitly tell you what is
missing and how you can provide a default or explicit assignment for the value
in question.

    \section{\function{grok.AutoFields}}

        \begin{funcdesc}{grok.AutoFields}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.adapts}}

        \begin{funcdesc}{grok.adapts}{*interfaces}
        foobar
        \end{funcdesc}

    \section{\function{grok.baseclass}}

        \begin{funcdesc}{grok.baseclass}{*interfaces}
        foobar
        \end{funcdesc}

    \section{\function{grok.define_permission}}

        \begin{funcdesc}{grok.define_permission}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.Fields}}

        \begin{funcdesc}{grok.Fields}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.implements}}

        \begin{funcdesc}{grok.implements}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.context}}

        \begin{funcdesc}{grok.context}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.global_utility}}

        \begin{funcdesc}{grok.global_utility}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.name}}

        \begin{funcdesc}{grok.name}{*arg}
        foobar
        \end{funcdesc}

        Used to associate a component with a name. Typically this directive is
        optional. The default behaviour when no name is given depends on the
        component.

    \section{\function{grok.local_utility}}

        \begin{funcdesc}{grok.local_utility}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.provides}}

        \begin{funcdesc}{grok.provides}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.resourcedir --- XXX Not implemented yet}}

        \begin{funcdesc}{grok.resourcedir}{*arg}
        foobar
        \end{funcdesc}

        Resource directories are used to embed static resources like HTML-,
        JavaScript-, CSS- and other files in your application.

        XXX insert directive description here (first: define the name, second:
        describe the default behaviour if the directive isn't given)

        A resource directory is created when a package contains a directory
        with the name \file{static}. All files from this directory become
        accessible from a browser under the URL
        \file{http://<servername>/++resource++<packagename>/<filename>}.

        \begin{bf}Example:\end{bf} The package \module{a.b.c} is grokked and
        contains a directory \file{static} which contains the file
        \file{example.css}. The stylesheet will be available via
        \file{http://<servername>/++resource++a.b.c/example.css}.

        \begin{notice}
        A package can never have both a \file{static} directory and a Python
        module with the name \file{static.py} at the same time. grok will
        remind you of this conflict when grokking a package by displaying an
        error message.
        \end{notice}

        \subsection{Linking to resources from templates}

            grok provides a convenient way to calculate the URLs to static
            resource using the keyword \keyword{static} in page templates:

            \begin{verbatim}
<link rel="stylesheet" tal:attributes="href static/example.css" type="text/css">
            \end{verbatim}

            The keyword \keyword{static} will be replaced by the reference to
            the resource directory for the package in which the template was
            registered.

    \section{\function{grok.require}}

        \begin{funcdesc}{grok.require}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.site}}

        \begin{funcdesc}{grok.site}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.template}}

        \begin{funcdesc}{grok.template}{*arg}
        foobar
        \end{funcdesc}

    \section{\function{grok.templatedir}}

        \begin{funcdesc}{grok.templatedir}{*arg}
        foobar
        \end{funcdesc}
