summaryrefslogtreecommitdiffstats
path: root/aconf/model/model.lua
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2016-12-09 19:50:10 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2016-12-19 22:40:51 +0200
commitcc8acc5fa708b9f24369d71b5e982a0314ca64d7 (patch)
tree4bbbe8eb323a8bf725f11c4081e9940779f2d43d /aconf/model/model.lua
parent88a2ee4783d15c74f735f26c48b621b5e848d334 (diff)
downloadaconf-cc8acc5fa708b9f24369d71b5e982a0314ca64d7.tar.bz2
aconf-cc8acc5fa708b9f24369d71b5e982a0314ca64d7.tar.xz
doc: describe functionality used in the network module
Diffstat (limited to 'aconf/model/model.lua')
-rw-r--r--aconf/model/model.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/aconf/model/model.lua b/aconf/model/model.lua
index ba6d004..8c62535 100644
--- a/aconf/model/model.lua
+++ b/aconf/model/model.lua
@@ -72,10 +72,12 @@ end
-- key&ndash;value pairs. The key will be the name of the field and
-- the value will determine its type. The value shall be a [field
-- class](#Overview_of_field_classes), an instance of field, or
--- another **&lt;Model&gt;**.
+-- another **&lt;Model&gt;**. The model's behavior can be customized
+-- by overriding some of its [methods](#Model_objects).
-- @param base (optional <i>**&lt;Model&gt;**</i>) base model
-- inherited by the new model.
--- @return <i>**&lt;Model&gt;**</i> new model
+-- @return <i>**&lt;Model&gt;**</i> new model, subclass of
+-- @{node.TreeNode}
function M.new(base)
if not base then base = M.Model end
@@ -185,6 +187,10 @@ function M.Model:init(context)
if self.is_removable then
function mt.removable()
+ --- determine whether this model object can be removed from
+ -- the data model.
+ -- @function is_removable
+ -- @treturn boolean true if the object is removable
return mt.has_permission('delete') and self:is_removable()
end
end
@@ -238,6 +244,10 @@ function M.Model:init(context)
if self:match(f.condition or {}) then f:validate_saved()
elseif f:_editable() then f:_save() end
end
+ --- check the validity of the model. This method may raise an
+ -- error or change the values of the model's fields. By default,
+ -- this method is not implemented.
+ -- @function validate
if self.validate then self:validate() end
end