Commit 07b49d54 authored by Gero Müller's avatar Gero Müller
Browse files

add extension docu

parent f3e2ec51
......@@ -2,6 +2,59 @@
Developer Guide
***************
Extensions
==========
Extensions add functionallity to the the VISPA Platform.
They provide new views in the browser and new functionality on the server.
The starting point for each extenion is a class extending AbstractExtension:
.. autoclass:: vispa.server.AbstractExtension
:members:
:undoc-members:
A minimal example looks like this:
.. code-block:: python
from vispa.server import AbstractExtension
class MyExtension(AbstractExtension):
def name(self):
return "myext"
def dependencies(self):
return []
def setup(self):
pass
Directories from which extensions are loaded:
- vispa/extensions
- $(var_dir)/extensions
- global packages starting with `vispa_`
In our example, the code above could be placed in a `__init__.py` file in a global package/directory named `vispa_myext-1.0`.
By default VISPA loads all extensions it finds, but extensions listed in `vispa.ini`, section `extensions`, option `ignore`
will be ignored:
.. code-block:: ini
[extensions]
ignore = myext
Controller
----------
Workspace
---------
Client
------
Create Database Migration Script
================================
......@@ -47,7 +47,7 @@ class AbstractExtension(object):
"""
Add a CSS file to be loaded.
:param filename filename relative to extension directory
:param filename: filename relative to extension directory
"""
url = vispa.url.static(filename, extension=self.name())
self.server.controller.add_common_css(url)
......@@ -56,7 +56,7 @@ class AbstractExtension(object):
"""
Add a JavaScript file to be loaded.
:param filename filename relative to extension directory
:param filename: filename relative to extension directory
"""
url = vispa.url.static(filename, extension=self.name())
self.server.controller.add_common_js(url)
......@@ -65,7 +65,7 @@ class AbstractExtension(object):
"""
Mount a CherryPy controller using the extension name for path.
:param filename filename relative to extension directory
:param controller: filename relative to extension directory
"""
controller.extension = self
self.server.controller.mount_extension_controller(self.name(),
......@@ -75,7 +75,7 @@ class AbstractExtension(object):
"""
Add files to be transferred to the worker.
:param directoy directory relative to extension directory
:param directoy: directory relative to extension directory
"""
class_dir = os.path.dirname(inspect.getabsfile(self.__class__))
local = os.path.join(class_dir, directory)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment