Skip to content

Commit

Permalink
[doc] new section re clean extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed May 14, 2012
1 parent 6e881fa commit d6c294b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions doc/writing-extensions.rst
Expand Up @@ -281,6 +281,28 @@ 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 d6c294b

Please sign in to comment.