doc/book/en/05-components.en.txt
changeset 81 f5886815126b
parent 74 9a9fe515934d
equal deleted inserted replaced
80:cb0c7936babf 81:f5886815126b
    22 A library of standard components is part of the `LAX` release (look at
    22 A library of standard components is part of the `LAX` release (look at
    23 ``lax/skel/ginco-apps``). Components provide entities and views. With
    23 ``lax/skel/ginco-apps``). Components provide entities and views. With
    24 ``lax-0.4``, you should get a set of application entities and system
    24 ``lax-0.4``, you should get a set of application entities and system
    25 entities you can re-use.
    25 entities you can re-use.
    26 
    26 
    27 The available application entities are :
    27 The available application entities are:
    28 
    28 
    29 * addressbook: PhoneNumber and PostalAddress
    29 * addressbook: PhoneNumber and PostalAddress
    30 
    30 
    31 * ebasket: Basket (like a shopping cart)
    31 * ebasket: Basket (like a shopping cart)
    32 
    32 
    49 * etask: Task (something to be done between start and stop date)
    49 * etask: Task (something to be done between start and stop date)
    50 
    50 
    51 * ezone: Zone (to define places within larger places, for example a
    51 * ezone: Zone (to define places within larger places, for example a
    52   city in a state in a country)
    52   city in a state in a country)
    53 
    53 
    54 The available system entities are :
    54 The available system entities are:
    55 
    55 
    56 * ecomment: Comment (to attach comment threads to entities)
    56 * ecomment: Comment (to attach comment threads to entities)
    57 
    57 
    58 
    58 
    59 
    59 
    63 To import a component in your application just change the line in the
    63 To import a component in your application just change the line in the
    64 ``app.conf`` file. For example::
    64 ``app.conf`` file. For example::
    65 
    65 
    66     included-yams-components=ecomment
    66     included-yams-components=ecomment
    67 
    67 
    68 Will make the ``Comment`` entity available in your ``BlogDemo``
    68 will make the ``Comment`` entity available in your ``BlogDemo``
    69 application.
    69 application.
    70 
    70 
    71 Change the schema to add a relationship between ``BlogEntry`` and
    71 Change the schema to add a relationship between ``BlogEntry`` and
    72 ``Comment`` and you are done. Since the ecomment component defines the
    72 ``Comment`` and you are done. Since the ecomment component defines the
    73 ``comments`` relationship, adding the line::
    73 ``comments`` relationship, adding the line::
    79 Clear the datastore and restart.
    79 Clear the datastore and restart.
    80 
    80 
    81 Component structure
    81 Component structure
    82 -------------------
    82 -------------------
    83 
    83 
    84 A complex component is structured as follows :
    84 A complex component is structured as follows:
    85 ::
    85 ::
    86 
    86 
    87   mycomponent/
    87   mycomponent/
    88   |
    88   |
    89   |-- schema.py
    89   |-- schema.py
   106   |
   106   |
   107   |-- debian/
   107   |-- debian/
   108   |
   108   |
   109   \-- __pkginfo__.py
   109   \-- __pkginfo__.py
   110 
   110 
   111 We can also define simple Python module instead of directories (packages), for example :
   111 We can also define simple Python module instead of directories (packages), for example:
   112 ::
   112 ::
   113 
   113 
   114   mycomponent/
   114   mycomponent/
   115   |
   115   |
   116   |-- entities.py
   116   |-- entities.py
   117   |-- hooks.py
   117   |-- hooks.py
   118   \-- views.py
   118   \-- views.py
   119 
   119 
   120 
   120 
   121 where :
   121 where:
   122 
   122 
   123 * ``schema`` contains the definition of the schema (server side only)
   123 * ``schema`` contains the definition of the schema (server side only)
   124 * ``entities`` contains entities definition (server side and web interface)
   124 * ``entities`` contains entities definition (server side and web interface)
   125 * ``sobjects`` contains hooks and/or notification views (server side only)
   125 * ``sobjects`` contains hooks and/or notification views (server side only)
   126 * ``views`` contains the web interface components (web interface only)
   126 * ``views`` contains the web interface components (web interface only)
   136   the usual files ``control``, ``rules``, ``changelog``... not installed)
   136   the usual files ``control``, ``rules``, ``changelog``... not installed)
   137 * file ``__pkginfo__.py`` provides component meta-data, especially the distribution
   137 * file ``__pkginfo__.py`` provides component meta-data, especially the distribution
   138   and the current version(server side and web interface) or sub-components used by
   138   and the current version(server side and web interface) or sub-components used by
   139   the component.
   139   the component.
   140  
   140  
   141 At least you should have :
   141 At least you should have:
   142 
   142 
   143 * the file ``__pkginfo__.py``
   143 * the file ``__pkginfo__.py``
   144 * schema definition
   144 * schema definition
   145 
   145 
   146 [WRITE ME]
   146 [WRITE ME]