[_modules] added a few docstrings
authorArthur Lutz <arthur.lutz@logilab.fr>
Thu, 11 Feb 2016 14:30:08 +0100
changeset 69 7597f1ea2d5b
parent 68 448139f2bee5
child 70 1f0307851fd5
[_modules] added a few docstrings
_modules/cubicweb.py
--- a/_modules/cubicweb.py	Thu Feb 11 14:29:40 2016 +0100
+++ b/_modules/cubicweb.py	Thu Feb 11 14:30:08 2016 +0100
@@ -182,6 +182,21 @@
 
 def create(name, cubes, install_type='all-in-one', **kwargs):
     '''
+    Return the list of available Cubicweb cubes, configurations and instances
+
+    name
+        name of the cubicweb instance
+    cubes
+        cubes to be installed in this instance
+    install_type    
+        installation type (optionnal, default : all-in-one)
+    kwargs
+        used to configure instance (see cubicweb.configure)
+
+    CLI Example::
+
+        salt '*' cubicweb.create blog blog 
+        salt '*' cubicweb.create blog blog all-in-one
     '''
     log.debug('create {0} ({1}): {2!r}'.format(name,install_type, cubes))
     if not isinstance(cubes, basestring):
@@ -196,6 +211,17 @@
 
 def configure(name, **kwargs):
     '''
+    Configure a cubicweb instance
+
+    name
+        name of the cubicweb instance
+    kwargs
+        used to configure instance 
+
+    CLI Example::
+
+        salt '*' cubicweb.configure blog key1=value1 
+        salt '*' cubicweb.configure blog smtp-host=localhost
     '''
     cmd = 'cubicweb-ctl configure '
     dbcfg = []
@@ -232,6 +258,15 @@
 
 def initialize(name, drop=False):
     '''Initialize the database for an instance
+
+    name: 
+        name of the instance
+    drop:
+        if True, drop the database first (default: False)
+
+    CLI Example::
+
+        salt '*' cubicweb.initialize blog
     '''
     cmd = ('cubicweb-ctl db-init --automatic --config-level 0 {0}').format(name)
     if drop:
@@ -252,7 +287,10 @@
         return cmd
 
 def restore(name, dumpfileurl, drop=False):
-    '''Restore the database for an instance from a dump file
+    '''
+    Restore the database for an instance from a dump file
+
+    TODO : restore from directory
     '''
     dumpfile = strip_proto(dumpfileurl)
     tmpdir = tempfile.mkdtemp()