summaryrefslogtreecommitdiff
path: root/docs/zcml/resource.rst
blob: 45aa1ce539a7ca23f10b49323f845801bfd31f77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.. _resource_directive:

``resource``
------------

The ``resource`` directive adds a resource override for a single
resource.

Attributes
~~~~~~~~~~

``to_override``

   A :term:`resource specification` specifying the resource to be
   overridden.

``override_with``

   A :term:`resource specification` specifying the resource which
   is used as the override.

Examples
~~~~~~~~

.. topic:: Overriding a Single Resource File

  .. code-block:: xml
     :linenos:

     <resource
       to_override="some.package:templates/mytemplate.pt"
       override_with="another.package:othertemplates/anothertemplate.pt"
     />

.. topic:: Overriding all Resources in a Package

  .. code-block:: xml
     :linenos:

     <resource
       to_override="some.package"
       override_with="another.package"
      />

.. topic:: Overriding all Resources in a Subdirectory of a Package

  .. code-block:: xml
     :linenos:

     <resource
       to_override="some.package:templates/"
       override_with="another.package:othertemplates/"
      />

Alternatives
~~~~~~~~~~~~

The :meth:`repoze.bfg.configuration.Configurator.override_resource`
method can be used instead of the ``resource`` ZCML directive.

See Also
~~~~~~~~

See also :ref:`resource_zcml_directive`.