PyWPS Templating system
pywps.Template.
IfToken
(type=None)¶Special token used for IF/ELSE constructions. This token contains childs for the whole IF block as well as ELSE block. It’s childs do have assigned ifOrElseChild attribute, which indicates, whether the child token belongs to IF block or the ELSE block.
Note
Childs of this token should appear on the same level of nesting, as this token. So any child token with the same name will get the same value.
pywps.Template.
LoopToken
(*args)¶Special token used for LOOPing constructions
Note
Childs of this token should appear on the same level of nesting, as this token. So any child token with the same name will get the same value.
pywps.Template.
TemplateError
¶General template exception
pywps.Template.
TemplateProcessor
(fileName=None, compile=True)¶Processor of the template class. This class is used for
getIncludedTokens
(token)¶Return list of tokens, which are taken from the included file
Parameters: | token – input token of type include |
---|---|
Returns: | list of tokens |
getToken
(statement)¶Create new token object, based on input text statement
Parameters: | statement (string) – some statement from the template |
---|---|
Returns: | new token instance |
isUpToDate
()¶Check, if the template is up-to-date, the compiled file is younger, than the original template file.
Return type: | boolean |
---|
readFromCompiled
()¶Set self.tokens from existing compiled file
recompile
()¶Set self.tokens from input text file and store them in compiled form for later usage.
set
(key, value, tokens=None, parent=None)¶Set value of some token
Parameters: |
|
---|---|
Returns: | list of tokens (with value set to desired value) |
tokenize
(templateData)¶Tokenize input text data.
Parameters: | templateData (string) – input text |
---|---|
Returns: | list of tokens |
pywps.Template.
Token
(type=None)¶Base Token class. Token is snipplet of input template. Template consits from list of tokens.
addChild
(childs)¶Add child to this Token
Note
You can submit also only one child to this method, it will be converted to list automatically.
Parameters: | child ([childs]) – list of child tokens |
---|
setParent
(parent)¶Set parent of this Token, assign it as child to other Token
Parameters: | parent (Token) – parent |
---|
setValue
(value)¶Set value for this token
Parameters: | value – any text or attribute, which will be assigned as value of this token |
---|
pywps.Template.
VarToken
(type=None)¶Token used for VAR constructions