No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fields.py 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #-*- coding: utf-8 -*-
  2. from EditorialModel.components import EmComponent
  3. """Represent one data for a lodel2 document"""
  4. class EmField(EmComponent):
  5. def __init__(id_or_name):
  6. """ Instanciate an EmType with data fetched from db
  7. @param id_or_name str|int: Identify the EmType by name or by global_id
  8. @throw TypeError
  9. @see EmComponent::__init__()
  10. """
  11. super(EmField, self).__init__()
  12. pass
  13. @staticmethod
  14. def create( name, em_fieldgroup, ml_repr = None, ml_help = None,
  15. icon = None, optionnal = False, type_relation = None,
  16. relationnal_field = None, primary_data = False,
  17. default_value = None, params = None, value = None):
  18. """ Create a new EmType and instanciate it
  19. @todo Change the icon param type
  20. @todo simplify function aguments ?
  21. @todo typeof default_value argument ?
  22. @todo typeof params argument ?
  23. @todo typeof value argument ?
  24. @static
  25. @param name str: The name of the new Type
  26. @param em_fieldgroup EmFieldGroup: The new field will belong to this fieldgroup
  27. @param ml_repr MlString|None: Multilingual representation of the type
  28. @param ml_help MlString|None: Multilingual help for the type
  29. @param The string|None: filename of the icon
  30. @param optionnal bool: Is the field optionnal ?
  31. @param type_relation EmType|None: If not None make a link between the class of the new EmField and this EmType
  32. @param relationnal_field EmField|None: If not None indicates that the new field defines the relation created by this EmField argument
  33. @param primary_data bool: Is the new field a primary data field ?
  34. @param default_value str: The field's default value
  35. @param params str: Params of the field
  36. @param value str: Value of the field
  37. @throw TypeError
  38. @see EmComponent::__init__()
  39. @staticmethod
  40. """
  41. pass
  42. def set_default(default_value):
  43. """ Set the default value
  44. @todo argument type ?
  45. @todo return type ?
  46. @param default_value anytype: The default value
  47. """
  48. pass
  49. def set_param(params):
  50. """ Set the field parameters
  51. @todo argument type ? EmFieldParam ?
  52. @todo return type ?
  53. @param params anytype: The field parameters
  54. """
  55. pass
  56. def set_value(v):
  57. """ Set the field value
  58. @todo Better explanations
  59. Don't set the field value in a document, it's a special kind of value
  60. @param The v: value
  61. """
  62. pass