mirror of
https://github.com/yweber/lodel2.git
synced 2026-07-28 00:43:28 +02:00
Normalized EmType comments
This commit is contained in:
parent
91ea809d5b
commit
b951a0328f
1 changed files with 59 additions and 71 deletions
|
|
@ -7,14 +7,13 @@ import sqlalchemy as sql
|
|||
import EditorialModel.fieldtypes as ftypes
|
||||
import EditorialModel.classes
|
||||
|
||||
## Represents type of documents
|
||||
# A type is a specialisation of a class, it can select optional field,
|
||||
# they have hooks, are organized in hierarchy and linked to other
|
||||
# EmType with special fields called relation_to_type fields
|
||||
#
|
||||
# @see EditorialModel::components::EmComponent
|
||||
class EmType(EmComponent):
|
||||
""" Represents type of documents
|
||||
|
||||
A type is a specialisation of a class, it can select optional field,
|
||||
they have hooks, are organized in hierarchy and linked to other
|
||||
EmType with special fields called relation_to_type fields
|
||||
@see EmComponent
|
||||
"""
|
||||
table = 'em_type'
|
||||
|
||||
## @brief Specific EmClass fields
|
||||
|
|
@ -26,107 +25,96 @@ class EmType(EmComponent):
|
|||
]
|
||||
|
||||
@classmethod
|
||||
## Create a new EmType and instanciate it
|
||||
# @param name str: The name of the new type
|
||||
# @param em_class EmClass: The class that the new type will specialize
|
||||
# @return An EmType instance
|
||||
#
|
||||
# @see EmComponent::__init__()
|
||||
#
|
||||
# @todo Remove hardcoded default value for icon
|
||||
# @todo check that em_class is an EmClass object
|
||||
def create(c, name, em_class):
|
||||
""" Create a new EmType and instanciate it
|
||||
|
||||
@param name str: The name of the new type
|
||||
@param em_class EmClass: The class that the new type will specialize
|
||||
|
||||
@see EmComponent::__init__()
|
||||
|
||||
@todo Remove hardcoded default value for icon
|
||||
@todo check that em_class is an EmClass object
|
||||
"""
|
||||
try:
|
||||
exists = EmType(name)
|
||||
except EmComponentNotExistError:
|
||||
return super(EmType, c).create(name=name, class_id=em_class.uid, icon=0)
|
||||
|
||||
return exists
|
||||
|
||||
|
||||
## Get the list of associated fieldgroups
|
||||
# @return A list of EditorialModel::fieldgroups::EmFieldGroup
|
||||
def field_groups(self):
|
||||
""" Get the list of associated fieldgroups
|
||||
@return A list of EmFieldGroup
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
## Get the list of associated fields
|
||||
# @return A list of EditorialModel::fields::EmField
|
||||
def fields(self):
|
||||
""" Get the list of associated fields
|
||||
@return A list of EmField
|
||||
"""
|
||||
pass
|
||||
|
||||
## Indicate that an optionnal field is used
|
||||
# @param field EmField: The optional field to select
|
||||
# @throw TypeError if field is not an EmField
|
||||
# @throw ValueError if field is not an optionnal field
|
||||
def select_field(self, field):
|
||||
""" Indicate that an optionnal field is used
|
||||
|
||||
@param field EmField: The optional field to select
|
||||
@throw ValueError, TypeError
|
||||
@todo change exception type and define return value and raise condition
|
||||
"""
|
||||
pass
|
||||
|
||||
## Indicate that an optionnal field will not be used (anymore)
|
||||
# @param field EmField: The optionnal field to unselect
|
||||
# @throw TypeError if field is not an EmField
|
||||
# @throw ValueError if field is not an optionnal field
|
||||
def unselect_field(self, field):
|
||||
""" Indicate that an optionnal field will not be used
|
||||
@param field EmField: The optional field to unselect
|
||||
@throw ValueError, TypeError
|
||||
@todo change exception type and define return value and raise condition
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
## Get the list of associated hooks
|
||||
# @note Not conceptualized yet
|
||||
# @todo Conception
|
||||
def hooks(self):
|
||||
"""Get the list of associated hooks"""
|
||||
pass
|
||||
|
||||
## Add a new hook
|
||||
# @param hook EmHook: An EmHook instance
|
||||
# @throw TypeError
|
||||
# @note Not conceptualized yet
|
||||
# @todo Conception
|
||||
def add_hook(self, hook):
|
||||
""" Add a new hook
|
||||
@param hook EmHook: A EmHook instance
|
||||
@throw TypeError
|
||||
"""
|
||||
pass
|
||||
|
||||
def del_hook(hook):
|
||||
""" Delete a hook
|
||||
@param hook EmHook: A EmHook instance
|
||||
@throw TypeError
|
||||
@todo Maybe we don't need a EmHook instance but just a hook identifier
|
||||
"""
|
||||
## Delete a hook
|
||||
# @param hook EmHook: An EmHook instance
|
||||
# @throw TypeError
|
||||
# @note Not conceptualized yet
|
||||
# @todo Conception
|
||||
# @todo Maybe we don't need a EmHook instance but just a hook identifier
|
||||
def del_hook(self,hook):
|
||||
pass
|
||||
|
||||
|
||||
## Get the list of superiors EmType in the type hierarchy
|
||||
# @return A list of EmType
|
||||
def superiors(self):
|
||||
""" Get the list of superiors EmType in the type hierarchy
|
||||
@return A list of EmType
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
## Add a superior in the type hierarchy
|
||||
# @param em_type EmType: An EmType instance
|
||||
# @param relation_nature str: The name of the relation's nature
|
||||
# @throw TypeError when em_type not an EmType instance
|
||||
# @throw ValueError when relation_nature isn't reconized or not allowed for this type
|
||||
# @todo define return value and raise condition
|
||||
def add_superior(self, em_type, relation_nature):
|
||||
""" Add a superior in the type hierarchy
|
||||
|
||||
@param em_type EmType: An EmType instance
|
||||
@param relation_nature str: The name of the relation's nature
|
||||
@throw TypeError
|
||||
@todo define return value and raise condition
|
||||
"""
|
||||
pass
|
||||
|
||||
## Delete a superior in the type hierarchy
|
||||
# @param em_type EmType: An EmType instance
|
||||
# @throw TypeError when em_type isn't an EmType instance
|
||||
# @todo define return value and raise condition
|
||||
def del_superior(self, em_type):
|
||||
""" Delete a superior in the type hierarchy
|
||||
|
||||
@param em_type EmType: An EmType instance
|
||||
@throw TypeError
|
||||
@todo define return value and raise condition
|
||||
"""
|
||||
pass
|
||||
|
||||
## @brief Get the list of linked type
|
||||
# Types are linked with special fields called relation_to_type fields
|
||||
# @return a list of EmType
|
||||
# @see EmFields
|
||||
def linked_types(self):
|
||||
""" Get the list of linked type
|
||||
|
||||
Types are linked with special fields called relation_to_type fields
|
||||
|
||||
@return a list of EmType
|
||||
@see EmFields
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue