for creole's zephir2 branch
This commit is contained in:
100
doc/api/epydoc.css
Normal file
100
doc/api/epydoc.css
Normal file
@ -0,0 +1,100 @@
|
||||
|
||||
/* Body color */
|
||||
body { background: #ffffff; color: #000000; }
|
||||
|
||||
/* Tables */
|
||||
table.summary, table.details, table.index
|
||||
{ background: #e8f0f8; color: #000000; }
|
||||
tr.summary, tr.details, tr.index
|
||||
{ background: #70b0f0; color: #000000;
|
||||
text-align: left; font-size: 120%; }
|
||||
tr.group { background: #c0e0f8; color: #000000;
|
||||
text-align: left; font-size: 120%;
|
||||
font-style: italic; }
|
||||
|
||||
/* Documentation page titles */
|
||||
h2.module { margin-top: 0.2em; }
|
||||
h2.class { margin-top: 0.2em; }
|
||||
|
||||
/* Headings */
|
||||
h1.heading { font-size: +140%; font-style: italic;
|
||||
font-weight: bold; }
|
||||
h2.heading { font-size: +125%; font-style: italic;
|
||||
font-weight: bold; }
|
||||
h3.heading { font-size: +110%; font-style: italic;
|
||||
font-weight: normal; }
|
||||
|
||||
/* Base tree */
|
||||
pre.base-tree { font-size: 80%; margin: 0; }
|
||||
|
||||
/* Details Sections */
|
||||
table.func-details { background: #e8f0f8; color: #000000;
|
||||
border: 2px groove #c0d0d0;
|
||||
padding: 0 1em 0 1em; margin: 0.4em 0 0 0; }
|
||||
h3.func-detail { background: transparent; color: #000000;
|
||||
margin: 0 0 1em 0; }
|
||||
|
||||
table.var-details { background: #e8f0f8; color: #000000;
|
||||
border: 2px groove #c0d0d0;
|
||||
padding: 0 1em 0 1em; margin: 0.4em 0 0 0; }
|
||||
h3.var-details { background: transparent; color: #000000;
|
||||
margin: 0 0 1em 0; }
|
||||
|
||||
/* Function signatures */
|
||||
.sig { background: transparent; color: #000000;
|
||||
font-weight: bold; }
|
||||
.sig-name { background: transparent; color: #006080; }
|
||||
.sig-arg, .sig-kwarg, .sig-vararg
|
||||
{ background: transparent; color: #008060; }
|
||||
.sig-default { background: transparent; color: #602000; }
|
||||
.summary-sig { background: transparent; color: #000000; }
|
||||
.summary-sig-name { background: transparent; color: #204080; }
|
||||
.summary-sig-arg, .summary-sig-kwarg, .summary-sig-vararg
|
||||
{ background: transparent; color: #008060; }
|
||||
|
||||
/* Doctest blocks */
|
||||
.py-src { background: transparent; color: #000000; }
|
||||
.py-prompt { background: transparent; color: #005050;
|
||||
font-weight: bold;}
|
||||
.py-string { background: transparent; color: #006030; }
|
||||
.py-comment { background: transparent; color: #003060; }
|
||||
.py-keyword { background: transparent; color: #600000; }
|
||||
.py-output { background: transparent; color: #404040; }
|
||||
pre.doctestblock { background: #f4faff; color: #000000;
|
||||
padding: .5em; margin: 1em;
|
||||
border: 1px solid #708890; }
|
||||
table pre.doctestblock
|
||||
{ background: #dce4ec; color: #000000;
|
||||
padding: .5em; margin: 1em;
|
||||
border: 1px solid #708890; }
|
||||
|
||||
/* Variable values */
|
||||
pre.variable { background: #dce4ec; color: #000000;
|
||||
padding: .5em; margin: 0;
|
||||
border: 1px solid #708890; }
|
||||
.variable-linewrap { background: transparent; color: #604000; }
|
||||
.variable-ellipsis { background: transparent; color: #604000; }
|
||||
.variable-quote { background: transparent; color: #604000; }
|
||||
.re { background: transparent; color: #000000; }
|
||||
.re-char { background: transparent; color: #006030; }
|
||||
.re-op { background: transparent; color: #600000; }
|
||||
.re-group { background: transparent; color: #003060; }
|
||||
.re-ref { background: transparent; color: #404040; }
|
||||
|
||||
/* Navigation bar */
|
||||
table.navbar { background: #a0c0ff; color: #0000ff;
|
||||
border: 2px groove #c0d0d0; }
|
||||
th.navbar { background: #a0c0ff; color: #0000ff; }
|
||||
th.navselect { background: #70b0ff; color: #000000; }
|
||||
.nomargin { margin: 0; }
|
||||
|
||||
/* Links */
|
||||
a:link { background: transparent; color: #0000ff; }
|
||||
a:visited { background: transparent; color: #204080; }
|
||||
a.navbar:link { background: transparent; color: #0000ff;
|
||||
text-decoration: none; }
|
||||
a.navbar:visited { background: transparent; color: #204080;
|
||||
text-decoration: none; }
|
||||
|
||||
/* Lists */
|
||||
ul { margin-top: 0; }
|
60
doc/certifs.txt
Normal file
60
doc/certifs.txt
Normal file
@ -0,0 +1,60 @@
|
||||
génération des certificats
|
||||
==========================
|
||||
|
||||
mode opératoire
|
||||
|
||||
|
||||
au premier lancement de ``gen_certif.py``
|
||||
------------------------------------------
|
||||
|
||||
- vérifie l'existence d'une CA ou non
|
||||
- génère la CA
|
||||
- génère les certificats par défaut (clef privée, requète de certificat)
|
||||
- signature des certificats
|
||||
|
||||
aux lancements ultérieurs
|
||||
-------------------------
|
||||
|
||||
|
||||
- vérifie l'existence d'une CA ou non
|
||||
- génère le certificat passé en argument
|
||||
|
||||
::
|
||||
|
||||
gen_certif.py (-f) [nom_certif]
|
||||
|
||||
si [nom_certif] non renseigné, regénère tous les certificats par défaut
|
||||
ainsi que la CA locale. Sinon, ne génère que [nom_certif]
|
||||
-f :force la regénération du (ou des) certificat(s) s'il(s) existe(nt)
|
||||
|
||||
|
||||
``regen``
|
||||
|
||||
attribut permettant de forcer (ou pas) la regénération
|
||||
si ``regen==True`` alors les cerficats sont regénérés même s'ils existent
|
||||
si ``regen==False`` alors les cerficats ne sont générés que s'ils
|
||||
n'existent pas.
|
||||
|
||||
api
|
||||
----
|
||||
|
||||
- génération d'un seul certificat :
|
||||
|
||||
``cert.gen_certif(certfile,regen=regen, copy_key=copy)``
|
||||
|
||||
|
||||
- génération de tous les certificats :
|
||||
|
||||
``cert.gen_certs(regen=regen)``
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
gen_certs()
|
||||
|-> gen_ca()
|
||||
|-> certif_loader()
|
||||
|-> gen_certif()
|
||||
|-> finalise_certs()
|
||||
|
||||
|
2
doc/clean.sh
Executable file
2
doc/clean.sh
Executable file
@ -0,0 +1,2 @@
|
||||
rm -f *.html
|
||||
rm -f api/*.html
|
15
doc/commande.txt
Normal file
15
doc/commande.txt
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
process
|
||||
-------
|
||||
|
||||
- point d'entrée : `process.py` méthode *run()*
|
||||
- lecture des fichiers dictionnaires *xml*
|
||||
- lecture du fichier */etc/eole/config.eol* pour remplir l'objet
|
||||
dictionnaire
|
||||
|
||||
|
||||
mapping avec la ligne de commande
|
||||
---------------------------------
|
||||
|
||||
.. TODO
|
377
doc/default.css
Normal file
377
doc/default.css
Normal file
@ -0,0 +1,377 @@
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger at users.sourceforge.net
|
||||
:date: $Date: 2004/11/11 23:11:44 $
|
||||
:version: $Revision: 1.1 $
|
||||
:copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
*/
|
||||
|
||||
/* "! important" is used here to override other ``margin-top`` and
|
||||
``margin-bottom`` styles that are later in the stylesheet or
|
||||
more specific. See <http://www.w3.org/TR/CSS1#the-cascade>. */
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Georgia, arial, sans-serif;
|
||||
padding: 3em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
width: 70%;
|
||||
margin: 2em auto;
|
||||
padding: 1em;
|
||||
background-color: #FFEEEE;
|
||||
border: 1px solid #EEDDDD;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 180%;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
/* Uncomment (& remove this text!) to get bold-faced definition list terms
|
||||
dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin-left: 1em ;
|
||||
border: medium outset ;
|
||||
padding: 0em 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr {
|
||||
width: 75% }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
pre.line-block {
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
.literal {
|
||||
color: #333;
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
pre.literal-block, pre.doctest-block {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em ;
|
||||
padding: 1em;
|
||||
color: #333;
|
||||
background-color: #EEE;}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.option-argument {
|
||||
font-style: italic }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
table {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.citation {
|
||||
border-left: solid thin gray }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid thin black }
|
||||
|
||||
td, th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
th.docinfo-name, th.field-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap }
|
||||
|
||||
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
||||
font-size: 100% }
|
||||
|
||||
tt {
|
||||
background-color: #eeeeee
|
||||
}
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
.code-block {
|
||||
font-family: Courier New, Courier, monospace;
|
||||
font-size: 14px;
|
||||
margin: 0 2em;
|
||||
padding: 1em;
|
||||
color: #000;
|
||||
background-color: #EEE;
|
||||
border: 1px solid #DDD;
|
||||
}
|
||||
|
||||
/* Python markup *********************************************/
|
||||
/*Python keyword*/
|
||||
.p_word {
|
||||
color: #036;
|
||||
}
|
||||
/*Python identifier*/
|
||||
.p_identifier {
|
||||
color: #36C;
|
||||
}
|
||||
/*Python number*/
|
||||
.p_number {
|
||||
color: #36C;
|
||||
}
|
||||
/*other text*/
|
||||
.p_default {
|
||||
color: #036;
|
||||
}
|
||||
/*Python operator*/
|
||||
.p_operator {
|
||||
color: #036;
|
||||
}
|
||||
/*Python comment*/
|
||||
.p_commentline {
|
||||
color: #036;
|
||||
}
|
||||
/*function name*/
|
||||
.p_defname {
|
||||
color: #F63;
|
||||
font-weight: bold;
|
||||
}
|
||||
/*class name*/
|
||||
.p_classname {
|
||||
color: #F00;
|
||||
font-weight: bold;
|
||||
}
|
||||
/*string literals*/
|
||||
.p_character {
|
||||
color: green;
|
||||
}
|
||||
/*string literals*/
|
||||
.p_string {
|
||||
color: green;
|
||||
}
|
||||
/*triple-quoted strings*/
|
||||
.p_triple {
|
||||
color: green;
|
||||
}
|
||||
|
||||
/* HTML markup *********************************************/
|
||||
/*an html tag*/
|
||||
.h_tag {
|
||||
color: #36C;
|
||||
}
|
||||
/*text in a tag*/
|
||||
.h_default {
|
||||
color: #036;
|
||||
}
|
||||
/*attribute name*/
|
||||
.h_attribute {
|
||||
color: #6C3;
|
||||
}
|
||||
/*a double-quoted attribute value*/
|
||||
.h_doublestring {
|
||||
color: green;
|
||||
}
|
||||
/*attribute equals sign, for example*/
|
||||
.h_other {
|
||||
color: #036;
|
||||
}
|
||||
|
1
doc/docutils.sh
Executable file
1
doc/docutils.sh
Executable file
@ -0,0 +1 @@
|
||||
buildhtml.py --embed --stylesheet default.css --output-encoding iso-8859-1 --prune .svn --prune api/ --prune pydoctor --prune data .
|
3
doc/epydoc.sh
Executable file
3
doc/epydoc.sh
Executable file
@ -0,0 +1,3 @@
|
||||
cd ../creole
|
||||
epydoc --html --no-private --output ../doc/api .
|
||||
|
57
doc/template.txt
Normal file
57
doc/template.txt
Normal file
@ -0,0 +1,57 @@
|
||||
Templates cr<63>ole
|
||||
================
|
||||
|
||||
comportement des templates
|
||||
--------------------------
|
||||
|
||||
Template_
|
||||
|
||||
.. _Template: api/creole.template.Template-class.html
|
||||
|
||||
validations
|
||||
-----------
|
||||
|
||||
Template.verify_
|
||||
|
||||
.. _Template.verify: api/creole.template.Template-class.html#verify
|
||||
|
||||
|
||||
|
||||
fichiers cibles
|
||||
fichiers mod<6F>le qui vont <20>tre instanci<63>s au final (fichier destination)
|
||||
|
||||
|
||||
- le fichier source (templatis<69>) *doit* exister ainsi que le
|
||||
fichier de destination (le fichier de configuration effectif)
|
||||
portant le m<>me nom :
|
||||
|
||||
- le fichier cible, c'est-<2D>-dire le fichier de configuration
|
||||
instanci<63>, doit <20>tre pr<70>sent
|
||||
|
||||
|
||||
>>> import creole
|
||||
>>> from creole.template import Template
|
||||
|
||||
>>> try:
|
||||
... t = Template('nexistepas.txt', templatedir= '/tmp')
|
||||
... t.verify()
|
||||
... except creole.error.FileNotFound, e:
|
||||
... print e
|
||||
...
|
||||
le fichier /tmp/nexistepas.txt n'existe pas
|
||||
>>>
|
||||
|
||||
.. note:: les deux v<>rifications (template source et fichier
|
||||
destination) sont faites en m<>me temps
|
||||
|
||||
- le r<>pertoire source *doit* exister
|
||||
|
||||
>>> try:
|
||||
... t = Template('/etc/group', templatedir= '/reperoire/qui/n/existe/pas')
|
||||
... t.verify()
|
||||
... except creole.error.FileNotFound, e:
|
||||
... print e
|
||||
...
|
||||
le fichier /reperoire/qui/n/existe/pas/group n'existe pas
|
||||
>>>
|
||||
|
41
doc/utils.txt
Normal file
41
doc/utils.txt
Normal file
@ -0,0 +1,41 @@
|
||||
utilitaires techniques cr<63>ole
|
||||
=============================
|
||||
|
||||
utilitaire de tests
|
||||
-------------------
|
||||
|
||||
|
||||
creolecat_
|
||||
|
||||
.. _creolecat: api/creole.creolecat-module.html
|
||||
|
||||
|
||||
un utilitaire de tests est mis <20> disposition pour ceux qui
|
||||
souhaitent tester leur fichiers de template sans pour autant lancer
|
||||
une instanciation:
|
||||
|
||||
usage::
|
||||
|
||||
creolecat.py -x <path>/eole.xml -o <path>/test.txt testtemplate.tmpl
|
||||
|
||||
testtemplate est le fichier <20> instancier
|
||||
|
||||
lancer l'option --help pour plus de d<>tails
|
||||
|
||||
utilitaire de conversion
|
||||
------------------------
|
||||
|
||||
conversion dans l'ancien langage de templating (notations *[%*)
|
||||
|
||||
pour ceux qui avaient d<>j<EFBFBD> commenc<6E> leur activit<69>s de templating pour
|
||||
cr<EFBFBD>ole 2 (donc avec une autre notation), un utilitaire de conversion
|
||||
est mis <20> disposition.
|
||||
Il est dans la lib python creole et s'appelle creole2cheetah_
|
||||
|
||||
.. _creole2cheetah: api/creole.creole2cheetah-module.html
|
||||
|
||||
usage :
|
||||
|
||||
cd creole
|
||||
[creole] ./creole2cheetah.py [nom du fichier source] > [nom du fichier destination]
|
||||
|
201
doc/variables.txt
Normal file
201
doc/variables.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Variables cr<63>ole
|
||||
================
|
||||
|
||||
typeole_
|
||||
|
||||
.. _typeole: api/creole.typeole-module.html
|
||||
|
||||
variable cr<63>ole
|
||||
|
||||
instance d'un objet type eole, <20> un nom de variable correspond
|
||||
peut-<2D>tre plusieurs valeurs
|
||||
|
||||
>>> from creole import typeole
|
||||
>>> var = typeole.EoleVar('mavariable')
|
||||
>>> var.val
|
||||
[]
|
||||
>>> var.set_value('valeur')
|
||||
>>> var.set_value('defaut', default=True)
|
||||
>>> var.val
|
||||
['valeur']
|
||||
>>> var.valdefault
|
||||
['defaut']
|
||||
>>> var.description = 'variable de test'
|
||||
>>> var.description
|
||||
'variable de test'
|
||||
>>>
|
||||
|
||||
il est possible de cr<63>er une variable Eole <20> l'aide
|
||||
d'une factory :
|
||||
|
||||
>>> var2 = typeole.type_factory('string', 'test_string', valeole=["eole"], valdefault=["def"])
|
||||
>>> var2.get_value()
|
||||
['def']
|
||||
>>>
|
||||
|
||||
des v<>rifications de type sont faites au moment du *set_value()*
|
||||
|
||||
collecte des variables cr<63>ole
|
||||
-----------------------------
|
||||
|
||||
collecte
|
||||
|
||||
R<>cup<75>ration de variables qui serviront a la constitution du dictionnaire Eole
|
||||
|
||||
Les donn<6E>es du dictionnaire sont collect<63>es <20><> partir de diff<66>rents fichiers dans un premier format XML.
|
||||
|
||||
sur une machine cible, une collecte des variables eole est faite avec parse_dico_::
|
||||
|
||||
from creole.parsedico import parse_dico
|
||||
parse_dico()
|
||||
|
||||
.. ce test n'est pas lanc<6E> car il peut y avoir un dico sur le poste
|
||||
de travail
|
||||
|
||||
.. _parse_dico: api/creole.parsedico-module.html
|
||||
|
||||
Le dictionnaire cr<63>ole est vide. Pour le remplir, il faut
|
||||
r<EFBFBD>cup<EFBFBD>rer des donn<6E>es depuis un fichier xml initial::
|
||||
|
||||
my_dict = EoleDict()
|
||||
my_dict.read(join('/etc/eole/','eole.xml'))
|
||||
|
||||
.. TODO: read_string(self, xml_string)
|
||||
|
||||
Utilisation du dictionnaire
|
||||
---------------------------
|
||||
|
||||
dictionnaire
|
||||
|
||||
fichier au format xml contenant :
|
||||
- une liste de fichiers
|
||||
- une liste de variables
|
||||
|
||||
famille
|
||||
|
||||
Il s'agit d'un regroupement de variable utilis<69> pour la saisie : on parle alors de famille de variables
|
||||
|
||||
groupe
|
||||
|
||||
Il s'agit de variables de type `liste` dont les <20>l<EFBFBD>ments sont li<6C>es aux <20>l<EFBFBD>ments correspondants des autres
|
||||
eth[2] aura un lien avec netmask[2] et network[2].
|
||||
|
||||
Plut<EFBFBD>t que d'utiliser `parsedico`, construisons un dictionnaire creole EoleDict_ :
|
||||
|
||||
>>> from creole import cfgparser
|
||||
>>> from creole import typeole
|
||||
>>>
|
||||
>>> dico = cfgparser.EoleDict()
|
||||
>>> dico.variables['ip_eth'] = typeole.type_factory('string', 'ip_eth', val=['ip0', 'ip1', 'ip2'])
|
||||
>>> dico.variables['nom_etab'] = typeole.type_factory('string', 'nom_etab', val=['etab'])
|
||||
>>> dico.variables['vrai'] = typeole.type_factory('boolean', 'vrai', val=[True])
|
||||
>>> dico.variables['faux'] = typeole.type_factory('string', 'faux', val=['faux'])
|
||||
>>> dico.variables['toto'] = typeole.type_factory('string', 'toto', val=['toto'])
|
||||
|
||||
voici comment acc<63>der aux variables cr<63>ole
|
||||
|
||||
>>> assert dico.get_value('ip_eth') == ['ip0', 'ip1', 'ip2']
|
||||
>>> assert dico.get_value('nom_etab') == ['etab']
|
||||
|
||||
.. _EoleDict : api/creole.cfgparser.EoleDict-class.html
|
||||
|
||||
|
||||
variables de template
|
||||
-----------------------
|
||||
|
||||
|
||||
lorsqu'on utilise un appel de bas niveau de traitement de template,
|
||||
c'est-<2D>-dire l'appel direct <20> la
|
||||
m<EFBFBD>thode process_ d'un template, il faut v<>rifier qu'une variable
|
||||
est bien instanci<63>e avec le bon contexte de dictionnaire :
|
||||
|
||||
.. _process: api/creole.template.Template-class.html
|
||||
|
||||
>>> from creole.cfgparser import EoleDict
|
||||
>>> from creole import typeole
|
||||
>>> from creole.template import Template
|
||||
>>> dico = EoleDict()
|
||||
>>> dico.variables['toto'] = typeole.type_factory('string',
|
||||
... 'toto', val=['toto'], context=dico)
|
||||
>>> t = Template('data/dst/test.tmpl', templatedir= 'data/src')
|
||||
>>> t.verify()
|
||||
>>> t.process(dico)
|
||||
>>> f = open('data/dst/test.tmpl')
|
||||
>>> res = f.read()
|
||||
>>> f.close()
|
||||
>>> assert 'titi' not in res
|
||||
>>> dico.set_value('toto', 'titi')
|
||||
>>> t.process(dico)
|
||||
>>> f = open('data/dst/test.tmpl')
|
||||
>>> res = f.read()
|
||||
>>> f.close()
|
||||
>>> assert 'titi' in res
|
||||
|
||||
le contexte `dico` est pass<73> <20> la variable `toto`::
|
||||
|
||||
dico.variables['toto'] = typeole.type_factory('string',
|
||||
'toto', val=['toto'], context=dico)
|
||||
|
||||
variables automatiques
|
||||
----------------------
|
||||
|
||||
variable automatique
|
||||
|
||||
variable pr<70>sente dans le dictionnaire xml mais pas dans le fichier *.ini* de configuration.
|
||||
la valeur de cette variable (sont appel <20> *.get_value()* est soumis <20> une fonction de traitement
|
||||
sp<73>cifi<66>e dans le xml, qui calcule la variable au lieu de formater sa valeur.
|
||||
|
||||
Une variable automatique simple n'est pas trait<69>e diff<66>remment d'une variable dont la valeur est pr<70>sente dans le dictionnaire et qui est soumise <20> une condition de v<>rification de sa valeur. Simplement, aucune v<>rification n'est effectu<74>e et la valeur est calcul<75>e.
|
||||
|
||||
d<EFBFBD>claration de la variable::
|
||||
|
||||
<variable name='server_mem' type='string' description='memoire du serveur' auto='True' />
|
||||
|
||||
d<EFBFBD>claration de la fonction de remplissage::
|
||||
|
||||
<fill name='server_mem' target='server_mem' />
|
||||
|
||||
deux fonctions strictement automatiques sont impl<70>ment<6E>es: `server_mem` et `kernel_version`
|
||||
|
||||
variable semi-automatique
|
||||
|
||||
variable remplit automatiquement dans le cas d'une condition sur une autre variable,
|
||||
si cette condition n'est pas remplie, c'est l'uilisateur qui la remplit (ou une autre fonction).
|
||||
la condition est trait<69>e <20> deux niveaux, dans la fonction de remplissage, et au niveau de l'affichage.
|
||||
On remplit donc deux fonctions pour ce conditionnement (une fonction fill avec la variable
|
||||
conditionnante en param<61>tre et une fonction condition qui conditionne l'affichage de la variable.
|
||||
exemple : r<>cup<75>ration des adresses eth dans le cas o<> l'on a pas de dhcp.
|
||||
|
||||
d<EFBFBD>claration de la variable semi-auto::
|
||||
|
||||
<variable name='eth0' type='string' auto='True'/>
|
||||
|
||||
d<EFBFBD>claration de la variable qui d<>finit la condition::
|
||||
|
||||
<variable name='dhcp' type='boolean' description='Activation du dhcp' >
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<check name='valid_enum' target='dhc'>
|
||||
<param>['oui','non']</param>
|
||||
</check>
|
||||
|
||||
d<EFBFBD>claration de la fonction de contr<74>le d'automatisme, la variable eth0 est remplie automatiquement par la fonction
|
||||
*auto_eth* si le param<61>tre dhcp est <20>gal <20> la condition *oui*::
|
||||
|
||||
<fill name='auto_eth' target='eth0'>
|
||||
<param>eth0</param>
|
||||
<param name='condition'>oui</param>
|
||||
<param type='eole' name='parametre'>dhcp</param>
|
||||
</fill>
|
||||
|
||||
d<EFBFBD>claration de la fonction de contr<74>le d'<27>ditabilit<69>::
|
||||
|
||||
<condition name='hidden_if_in' source='dhc'>
|
||||
<param>oui</param>
|
||||
<target type='variable'>eth0</target>
|
||||
</condition>
|
||||
|
||||
pour l'instant sont diposnible auto_eth, auto_netmask, auto_broadcast et auto_network.
|
||||
|
||||
|
||||
|
8
doc/xml.txt
Normal file
8
doc/xml.txt
Normal file
@ -0,0 +1,8 @@
|
||||
le fichier de configuration cr<63>ole
|
||||
==================================
|
||||
|
||||
format xml
|
||||
----------
|
||||
|
||||
Pour plus de documentation sur le format xml du dictionnaire cr<63>ole,
|
||||
se r<>f<EFBFBD>rer <20> la documentation l'<27>diteur xml cr<63>ole ( *exc*)
|
Reference in New Issue
Block a user