Skip to content

Commit

Permalink
[doc] move section
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed May 14, 2012
1 parent 42c6a8c commit 267b10a
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions doc/writing-extensions.rst
Expand Up @@ -167,6 +167,28 @@ For full list of Plugin Interfaces see the `Plugin API documentation`_ below.
.. _PyUtilib: https://software.sandia.gov/trac/pyutilib


Writing Extensions
------------------

.. Note ::
Where possible extensions should be written so that they do not rely on a specific version of CKAN. This means that it is important not to rely on classes/functions in CKAN core.
To enable extensions to be able to use core functionality a helper object is provided `ckan.plugins.toolkit` that is a wrapper for certain functions and classes. By using this extensions you do not need to worry about code changes in CKAN core as the provided functions will continue to be supported.

Example::
>>> import ckan.plugins as p
...
...
... class MyPlugin(p.SingletonPlugin):
... '''My plugin.'''
...
... p.implements(p.IConfigurer)
...
... def update_config(self, config):
... p.toolkit.add_template_directory(config, 'templates')
... p.toolkit.add_public_directory(config, 'public')


Example CKAN Extension
----------------------

Expand Down Expand Up @@ -281,28 +303,6 @@ The order in which extensions are used is:
3. If a plugin has more than one entry point these are in alphabetical order.


Writing Extensions
------------------

.. Note ::
Where possible extensions should be written so that they do not rely on a specific version of CKAN. This means that it is important not to rely on classes/functions in CKAN core.
To enable extensions to be able to use core functionality a helper object is provided `ckan.plugins.toolkit` that is a wrapper for certain functions and classes. By using this extensions do not need to worry about code changes in CKAN core as the provided functions will continue to be supported.

Example::
import ckan.plugins as p


class MyPlugin(p.SingletonPlugin):
'''My plugin.'''

p.implements(p.IConfigurer)

def update_config(self, config):
p.toolkit.add_template_directory(config, 'templates')
p.toolkit.add_public_directory(config, 'public')



Plugin API Documentation
------------------------
Expand Down

0 comments on commit 267b10a

Please sign in to comment.