Keyword¶
-
class
Cauldron.base.dispatcher.
Keyword
[source] [edit on github]¶ Bases:
Cauldron.base.core._BaseKeyword
A dispatcher-based keyword, which should own its own values.
Attributes Summary
value
Map .value to ._last_value, the cauldron internal location of this variable. Methods Summary
callback
(function[, remove])Register a function to be called whenever this keyword is set to a new value. check
(value)Check that ‘value’ is appropriate for this keyword. modify
(value)Modify this keyword’s value. period
(period)How often a keyword should be updated. postread
(value)Take some action post-read. postwrite
(value)Take some action post-write. preread
()Take some action before this value is read. prewrite
(value)Any actions which need to occur before a value is written. read
()Read the value from the authority source. schedule
([appointment, cancel])Schedule an update. set
(value[, force])Set the keyword to the value provided, and broadcast changes. translate
(value)Translate a value into a standard representation. update
()Update the value by performing a read. write
(value)Write the value to the authority source. Attributes Documentation
-
value
¶ Map .value to ._last_value, the cauldron internal location of this variable.
Methods Documentation
-
callback
(function, remove=False)[source] [edit on github]¶ Register a function to be called whenever this keyword is set to a new value.
-
check
(value)[source] [edit on github]¶ Check that ‘value’ is appropriate for this keyword. If it is not, raise a value error.
This method can be overridden to provide specific behavior in user subclasses.
-
modify
(value)[source] [edit on github]¶ Modify this keyword’s value. This is the public function which should be called to change a keyword value.
-
period
(period)[source] [edit on github]¶ How often a keyword should be updated.
Warning
period
is not implemented in the Cauldron version of the KTL API.
-
postread
(value)[source] [edit on github]¶ Take some action post-read. Called at the end of
update()
.This method can be overridden to provide specific behavior in user subclasses.
-
postwrite
(value)[source] [edit on github]¶ Take some action post-write.
This method can be overridden to provide specific behavior in user subclasses.
-
preread
()[source] [edit on github]¶ Take some action before this value is read. Called at the start of
update()
.This method can be overridden to provide specific behavior in user subclasses.
-
prewrite
(value)[source] [edit on github]¶ Any actions which need to occur before a value is written. Called to adjust the value in
modify()
.This can raise
NoWriteNecessary
if a write is not necessary.This method can be overridden to provide specific behavior in user subclasses.
-
read
()[source] [edit on github]¶ Read the value from the authority source. Called to get the value for
update()
.This method can be overridden to provide specific behavior in user subclasses.
-
schedule
(appointment=None, cancel=False)[source] [edit on github]¶ Schedule an update.
Warning
schedule
is not implemented in the Cauldron version of the KTL API.
-
set
(value, force=False)[source] [edit on github]¶ Set the keyword to the value provided, and broadcast changes.
Parameters: - value – The keyword value.
- force (bool) – Whether to force the change, or ignore repeatedly setting a keyword to the same value.
-
translate
(value)[source] [edit on github]¶ Translate a value into a standard representation.
This method can be overridden to provide specific behavior in user subclasses.
-
update
()[source] [edit on github]¶ Update the value by performing a read. This is the public function which should be called when the keyword is read.
-
write
(value)[source] [edit on github]¶ Write the value to the authority source. Called to adjust the value in
modify()
.This method can be overridden to provide specific behavior in user subclasses.
-