当前位置: 首页>>代码示例>>Python>>正文


Python Field.__init__方法代码示例

本文整理汇总了Python中appy.fields.Field.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Field.__init__方法的具体用法?Python Field.__init__怎么用?Python Field.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appy.fields.Field的用法示例。


在下文中一共展示了Field.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              show=True, page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=5, height=None,
              maxChars=13, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              sdefault=('',''), scolspan=1, swidth=None, sheight=None,
              persist=True, precision=None, sep=(',', '.'), tsep=' '):
     # The precision is the number of decimal digits. This number is used
     # for rendering the float, but the internal float representation is not
     # rounded.
     self.precision = precision
     # The decimal separator can be a tuple if several are allowed, ie
     # ('.', ',')
     if type(sep) not in sutils.sequenceTypes:
         self.sep = (sep,)
     else:
         self.sep = sep
     # Check that the separator(s) are among allowed decimal separators
     for sep in self.sep:
         if sep not in Float.allowedDecimalSeps:
             raise Exception('Char "%s" is not allowed as decimal ' \
                             'separator.' % sep)
     self.tsep = tsep
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, False,
                    specificReadPermission, specificWritePermission, width,
                    height, maxChars, colspan, master, masterValue, focus,
                    historized, mapping, label, sdefault, scolspan, swidth,
                    sheight, persist)
     self.pythonType = float
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:33,代码来源:float.py

示例2: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              format=WITH_HOUR, dateFormat=None, hourFormat=None,
              calendar=True, startYear=time.localtime()[0]-10,
              endYear=time.localtime()[0]+10, reverseYears=False,
              show=True, page='main', group=None, layouts=None, move=0,
              indexed=False, mustIndex=True, searchable=False,
              specificReadPermission=False, specificWritePermission=False,
              width=None, height=None, maxChars=None, colspan=1, master=None,
              masterValue=None, focus=False, historized=False, mapping=None,
              label=None, sdefault=None, scolspan=1, swidth=None,
              sheight=None, persist=True, view=None, xml=None, showDay=True):
     self.format = format
     self.calendar = calendar
     self.startYear = startYear
     self.endYear = endYear
     # If reverseYears is True, in the selection box, available years, from
     # self.startYear to self.endYear will be listed in reverse order.
     self.reverseYears = reverseYears
     # If p_showDay is False, the list for choosing a day will be hidden.
     self.showDay = showDay
     # If no p_dateFormat/p_hourFormat is specified, the application-wide
     # tool.dateFormat/tool.hourFormat instead.
     self.dateFormat = dateFormat
     self.hourFormat = hourFormat
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, mustIndex, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, mapping, label, sdefault, scolspan, swidth,
                    sheight, persist, False, view, xml)
开发者ID:tonibagur,项目名称:appy,代码行数:32,代码来源:date.py

示例3: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(1,1), default=None,
              show=True, page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, action=None, result='computation',
              confirm=False, master=None, masterValue=None, focus=False,
              historized=False, mapping=None, label=None):
     # Can be a single method or a list/tuple of methods
     self.action = action
     # For the 'result' param:
     #  * value 'computation' means that the action will simply compute
     #    things and redirect the user to the same page, with some status
     #    message about execution of the action;
     #  * 'file' means that the result is the binary content of a file that
     #    the user will download.
     #  * 'redirect' means that the action will lead to the user being
     #    redirected to some other page.
     self.result = result
     # If following field "confirm" is True, a popup will ask the user if
     # she is really sure about triggering this action.
     self.confirm = confirm
     Field.__init__(self, None, (0,1), default, show, page, group, layouts,
                    move, indexed, False, specificReadPermission,
                    specificWritePermission, width, height, None, colspan,
                    master, masterValue, focus, historized, mapping, label,
                    None, None, None, None, False)
     self.validable = False
     self.renderLabel = False # Label is rendered directly within the button.
开发者ID:Alejoss,项目名称:django-sis,代码行数:30,代码来源:action.py

示例4: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              show='view', page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, method=None, plainText=True,
              master=None, masterValue=None, focus=False, historized=False,
              sync=True, mapping=None, label=None, sdefault='', scolspan=1,
              swidth=None, sheight=None, context={}):
     # The Python method used for computing the field value
     self.method = method
     # Does field computation produce plain text or XHTML?
     self.plainText = plainText
     if isinstance(method, basestring):
         # When field computation is done with a macro, we know the result
         # will be HTML.
         self.plainText = False
     # The context is a dict (or method returning a dict) that will be given
     # to the macro specified in self.method. If the dict contains key
     # "someKey", it will be available to the macro as "options/someKey".
     self.context = context
     Field.__init__(self, None, multiplicity, default, show, page, group,
                    layouts, move, indexed, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, sync, mapping, label, sdefault, scolspan,
                    swidth, sheight)
     self.validable = False
开发者ID:Sateanu,项目名称:django-sis,代码行数:29,代码来源:computed.py

示例5: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(
     self,
     validator=None,
     multiplicity=(0, 1),
     default=None,
     show=True,
     page="main",
     group=None,
     layouts=None,
     move=0,
     indexed=False,
     searchable=False,
     specificReadPermission=False,
     specificWritePermission=False,
     width=5,
     height=None,
     maxChars=13,
     colspan=1,
     master=None,
     masterValue=None,
     focus=False,
     historized=False,
     mapping=None,
     label=None,
     sdefault=("", ""),
     scolspan=1,
     swidth=None,
     sheight=None,
 ):
     Field.__init__(
         self,
         validator,
         multiplicity,
         default,
         show,
         page,
         group,
         layouts,
         move,
         indexed,
         searchable,
         specificReadPermission,
         specificWritePermission,
         width,
         height,
         maxChars,
         colspan,
         master,
         masterValue,
         focus,
         historized,
         True,
         mapping,
         label,
         sdefault,
         scolspan,
         swidth,
         sheight,
     )
     self.pythonType = long
开发者ID:pombredanne,项目名称:django-sis,代码行数:62,代码来源:integer.py

示例6: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              show=('view', 'result'), page='main', group=None,
              layouts=None, move=0, indexed=False, searchable=False,
              specificReadPermission=False, specificWritePermission=False,
              width=None, height=None, maxChars=None, colspan=1, method=None,
              formatMethod=None, plainText=False, master=None,
              masterValue=None, focus=False, historized=False, mapping=None,
              label=None, sdefault='', scolspan=1, swidth=None, sheight=None,
              context=None):
     # The Python method used for computing the field value, or a PX.
     self.method = method
     # A specific method for producing the formatted value of this field.
     # This way, if, for example, the value is a DateTime instance which is
     # indexed, you can specify in m_formatMethod the way to format it in
     # the user interface while m_method computes the value stored in the
     # catalog.
     self.formatMethod = formatMethod
     if isinstance(self.method, basestring):
         # A legacy macro identifier. Raise an exception
         raise Exception(self.WRONG_METHOD % self.method)
     # Does field computation produce plain text or XHTML?
     self.plainText = plainText
     if isinstance(method, Px):
         # When field computation is done with a PX, the result is XHTML.
         self.plainText = False
     # If method is a PX, its context can be given in p_context.
     self.context = context
     Field.__init__(self, None, multiplicity, default, show, page, group,
                    layouts, move, indexed, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, mapping, label, sdefault, scolspan, swidth,
                    sheight, False)
     self.validable = False
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:36,代码来源:computed.py

示例7: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, default=None, show=('view', 'result'),
              page='main', group=None, layouts=None, move=0, indexed=False,
              searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              template=None, context=None, action=None, askAction=False,
              stylesMapping={}, freezeFormat='pdf'):
     # The following param stores the path to a POD template
     self.template = template
     # The context is a dict containing a specific pod context, or a method
     # that returns such a dict.
     self.context = context
     # Next one is a method that will be triggered after the document has
     # been generated.
     self.action = action
     # If askAction is True, the action will be triggered only if the user
     # checks a checkbox, which, by default, will be unchecked.
     self.askAction = askAction
     # A global styles mapping that would apply to the whole template
     self.stylesMapping = stylesMapping
     # Freeze format is by PDF by default
     self.freezeFormat = freezeFormat
     Field.__init__(self, None, (0,1), default, show, page, group, layouts,
                    move, indexed, searchable, specificReadPermission,
                    specificWritePermission, width, height, None, colspan,
                    master, masterValue, focus, historized, False, mapping,
                    label, None, None, None, None)
     self.validable = False
开发者ID:Sateanu,项目名称:django-sis,代码行数:31,代码来源:pod.py

示例8: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, fields, validator=None, multiplicity=(0,1), default=None,
              show=True, page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width='', height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              subLayouts=Table('frv', width=None), widths=None):
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, False,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, mapping, label, None, None, None, None, True)
     self.validable = True
     # Tuples of (names, Field instances) determining the format of every
     # element in the list.
     self.fields = fields
     # Force some layouting for sub-fields, if subLayouts are given. So the
     # one who wants freedom on tuning layouts at the field level must
     # specify subLayouts=None.
     if subLayouts:
         for name, field in self.fields:
             field.layouts = field.formatLayouts(subLayouts)
     # One may specify the width of every column in the list. Indeed, using
     # widths and layouts of sub-fields may not be sufficient.
     if not widths:
         self.widths = [''] * len(self.fields)
     else:
         self.widths = widths
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:30,代码来源:list.py

示例9: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              format=LINE, show=True, page='main', group=None, layouts=None,
              move=0, indexed=False, searchable=False,
              specificReadPermission=False, specificWritePermission=False,
              width=None, height=None, maxChars=None, colspan=1, master=None,
              masterValue=None, focus=False, historized=False, mapping=None,
              label=None, sdefault='', scolspan=1, swidth=None, sheight=None,
              transform='none', styles=('p','h1','h2','h3','h4'),
              allowImageUpload=True, inlineEdit=False):
     # According to format, the widget will be different: input field,
     # textarea, inline editor... Note that there can be only one String
     # field of format CAPTCHA by page, because the captcha challenge is
     # stored in the session at some global key.
     self.format = format
     self.isUrl = validator == String.URL
     # When format is XHTML, the list of styles that the user will be able to
     # select in the styles dropdown is defined hereafter.
     self.styles = styles
     # When format is XHTML, do we allow the user to upload images in it ?
     self.allowImageUpload = allowImageUpload
     # When format in XHTML, can the field be inline-edited (ckeditor)?
     self.inlineEdit = inlineEdit
     # The following field has a direct impact on the text entered by the
     # user. It applies a transformation on it, exactly as does the CSS
     # "text-transform" property. Allowed values are those allowed for the
     # CSS property: "none" (default), "uppercase", "capitalize" or
     # "lowercase".
     self.transform = transform
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, maxChars, colspan, master, masterValue, focus,
                    historized, True, mapping, label, sdefault, scolspan,
                    swidth, sheight)
     self.isSelect = self.isSelection()
     # If self.isSelect, self.sdefault must be a list of value(s).
     if self.isSelect and not sdefault:
         self.sdefault = []
     # Default width, height and maxChars vary according to String format
     if width == None:
         if format == String.TEXT:  self.width  = 60
         # This width corresponds to the standard width of an Appy page.
         if format == String.XHTML: self.width  = None
         else:                      self.width  = 30
     if height == None:
         if format == String.TEXT: self.height = 5
         elif self.isSelect:       self.height = 4
         else:                     self.height = 1
     if maxChars == None:
         if self.isSelect: pass
         elif format == String.LINE: self.maxChars = 256
         elif format == String.TEXT: self.maxChars = 9999
         elif format == String.XHTML: self.maxChars = 99999
         elif format == String.PASSWORD: self.maxChars = 20
     self.filterable = self.indexed and (self.format == String.LINE) and \
                       not self.isSelect
     self.swidth = self.swidth or self.width
     self.sheight = self.sheight or self.height
开发者ID:Sateanu,项目名称:django-sis,代码行数:60,代码来源:string.py

示例10: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, multiplicity=(0,1), default=None, show=None, page='main',
   group=None, layouts=None, move=0, indexed=False, mustIndex=True,
   searchable=False, specificReadPermission=False,
   specificWritePermission=False, width=None, height=None, maxChars=None,
   colspan=1, method=None, formatMethod=None, plainText=False, master=None,
   masterValue=None, focus=False, historized=False, mapping=None, label=None,
   sdefault='', scolspan=1, swidth=None, sheight=None, context=None,
   view=None, xml=None, unfreezable=False, validable=False):
     # The Python method used for computing the field value, or a PX
     self.method = method
     # A specific method for producing the formatted value of this field.
     # This way, if, for example, the value is a DateTime instance which is
     # indexed, you can specify in m_formatMethod the way to format it in
     # the user interface while m_method computes the value stored in the
     # catalog.
     self.formatMethod = formatMethod
     if isinstance(self.method, basestring):
         # A legacy macro identifier. Raise an exception
         raise Exception(self.WRONG_METHOD % self.method)
     # Does field computation produce plain text or XHTML?
     self.plainText = plainText
     if isinstance(method, Px):
         # When field computation is done with a PX, the result is XHTML
         self.plainText = False
     # Determine default value for "show"
     if show == None:
         # XHTML content in a Computed field generally corresponds to some
         # custom XHTML widget. This is why, by default, we do not render it
         # in the xml layout.
         show = self.plainText and ('view', 'result', 'xml') or \
                                   ('view', 'result')
     # If method is a PX, its context can be given in p_context
     self.context = context
     Field.__init__(self, None, multiplicity, default, show, page, group,
                    layouts, move, indexed, mustIndex, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, mapping, label, sdefault, scolspan, swidth,
                    sheight, False, False, view, xml)
     # When a custom widget is built from a computed field, its values are
     # potentially editable an validable, so "validable" must be True.
     self.validable = validable
     # One classic use case for a Computed field is to build a custom widget.
     # In this case, self.method stores a PX or method that produces, on
     # view or edit, the custom widget. Logically, you will need to store a
     # custom data structure on obj.o, in an attribute named according to
     # this field, ie self.name. Typically, you will set or update a value
     # for this attribute in obj.onEdit, by getting, on the obj.request
     # object, values encoded by the user in your custom widget (edit mode).
     # This "custom widget" use case is incompatible with "freezing". Indeed,
     # freezing a Computed field implies storing the computed value at
     # obj.o.[self.name] instead of recomputing it as usual. So if you want
     # to build a custom widget, specify the field as being unfreezable.
     self.unfreezable = unfreezable
开发者ID:tonibagur,项目名称:appy,代码行数:56,代码来源:computed.py

示例11: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(1,1), default=None,
              show='view', page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None):
     Field.__init__(self, None, (0,1), default, show, page, group, layouts,
                    move, indexed, False, specificReadPermission,
                    specificWritePermission, width, height, None, colspan,
                    master, masterValue, focus, historized, mapping, label,
                    None, None, None, None, False)
     self.validable = False
开发者ID:Alejoss,项目名称:django-sis,代码行数:14,代码来源:info.py

示例12: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              show=True, page='main', group=None, layouts = None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              sdefault=False, scolspan=1, swidth=None, sheight=None,
              persist=True, render='checkbox'):
     # By default, a boolean is edited via a checkbox. It can also be edited
     # via 2 radio buttons (p_render="radios").
     self.render = render
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, mapping, label, sdefault, scolspan, swidth,
                    sheight, persist)
     self.pythonType = bool
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:20,代码来源:boolean.py

示例13: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, fields, validator=None, multiplicity=(0,1), default=None,
              show=True, page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              subLayouts=Table('fv', width=None)):
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, False,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, True, mapping, label, None, None, None, None)
     self.validable = True
     # Tuples of (names, Field instances) determining the format of every
     # element in the list.
     self.fields = fields
     self.fieldsd = [(n, f.__dict__) for (n,f) in self.fields]
     # Force some layouting for sub-fields, if subLayouts are given. So the
     # one who wants freedom on tuning layouts at the field level must
     # specify subLayouts=None.
     if subLayouts:
         for name, field in self.fields:
             field.layouts = field.formatLayouts(subLayouts)
开发者ID:Sateanu,项目名称:django-sis,代码行数:25,代码来源:list.py

示例14: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, multiplicity=(0,1), default=None,
              format=WITH_HOUR, calendar=True,
              startYear=time.localtime()[0]-10,
              endYear=time.localtime()[0]+10, reverseYears=False,
              show=True, page='main', group=None, layouts=None, move=0,
              indexed=False, searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              sdefault=None, scolspan=1, swidth=None, sheight=None):
     self.format = format
     self.calendar = calendar
     self.startYear = startYear
     self.endYear = endYear
     # If reverseYears is True, in the selection box, available years, from
     # self.startYear to self.endYear will be listed in reverse order.
     self.reverseYears = reverseYears
     Field.__init__(self, validator, multiplicity, default, show, page,
                    group, layouts, move, indexed, searchable,
                    specificReadPermission, specificWritePermission, width,
                    height, None, colspan, master, masterValue, focus,
                    historized, True, mapping, label, sdefault, scolspan,
                    swidth, sheight)
开发者ID:Sateanu,项目名称:django-sis,代码行数:25,代码来源:date.py

示例15: __init__

# 需要导入模块: from appy.fields import Field [as 别名]
# 或者: from appy.fields.Field import __init__ [as 别名]
 def __init__(self, validator=None, default=None, show=('view', 'result'),
              page='main', group=None, layouts=None, move=0, indexed=False,
              searchable=False, specificReadPermission=False,
              specificWritePermission=False, width=None, height=None,
              maxChars=None, colspan=1, master=None, masterValue=None,
              focus=False, historized=False, mapping=None, label=None,
              template=None, templateName=None, showTemplate=None,
              freezeTemplate=None, maxPerRow=5, context=None,
              stylesMapping={}, formats=None, getChecked=None, mailing=None,
              mailingName=None, showMailing=None, mailingInfo=None):
     # Param "template" stores the path to the pod template(s). If there is
     # a single template, a string is expected. Else, a list or tuple of
     # strings is expected. Every such path must be relative to your
     # application. A pod template name Test.odt that is stored at the root
     # of your app will be referred as "Test.odt" in self.template. If it is
     # stored within sub-folder "pod", it will be referred as "pod/Test.odt".
     if not template: raise Exception(Pod.NO_TEMPLATE)
     if isinstance(template, basestring):
         self.template = [template]
     elif isinstance(template, tuple):
         self.template = list(template)
     else:
         self.template = template
     # Param "templateName", if specified, is a method that will be called
     # with the current template (from self.template) as single arg and must
     # return the name of this template. If self.template stores a single
     # template, you have no need to use param "templateName". Simply use the
     # field label to name the template. But if you have a multi-pod field
     # (with several templates specified as a list or tuple in param
     # "template"), you will probably choose to hide the field label and use
     # param "templateName" to give a specific name to every template. If
     # "template" contains several templates and "templateName" is None, Appy
     # will produce names from template filenames.
     self.templateName = templateName
     # "showTemplate" determines if the current user may generate documents
     # based on this pod field. More precisely, "showTemplate", if specified,
     # must be a method that will be called with the current template as
     # single arg (one among self.template) and that must return the list or
     # tuple of formats that the current user may use as output formats for
     # generating a document. If the current user is not allowed at all to
     # generate documents based on the current template, "showTemplate" must
     # return an empty tuple/list. If "showTemplate" is not specified, the
     # user will be able to generate documents based on the current template,
     # in any format from self.formats (see below).
     # "showTemplate" comes in addition to self.show. self.show dictates the
     # visibility of the whole field (ie, all templates from self.template)
     # while "showTemplate" dictates the visiblity of a specific template
     # within self.template.
     self.showTemplate = showTemplate
     # "freezeTemplate" determines if the current user may freeze documents
     # normally generated dynamically from this pod field. More precisely,
     # "freezeTemplate", if specified, must be a method that will be called
     # with the current template as single arg and must return the (possibly
     # empty) list or tuple of formats the current user may freeze. The
     # "freezing-related actions" that are granted by "freezeTemplate" are
     # the following. When no document is frozen yet for a given
     # template/format, the user may:
     # - freeze the document: pod will be called to produce a document from
     #   the current database content and will store it in the database.
     #   Subsequent user requests for this pod field will return the frozen
     #   doc instead of generating on-the-fly documents;
     # - upload a document: the user will be able to upload a document that
     #   will be stored in the database. Subsequent user requests for this
     #   pod field will return this doc instead of generating on-the-fly
     #   documents.
     # When a document is already frozen or uploaded for a given
     # template/format, the user may:
     # - unfreeze the document: the frozen or uploaded document will be
     #   deleted from the database and subsequent user requests for the pod
     #   field will again generate on-the-fly documents;
     # - re-freeze the document: the frozen or uploaded document will be
     #   deleted, a new document will be generated from the current database
     #   content and will be frozen as a replacement to the deleted one;
     # - upload a document: the frozen or uploaded document will be replaced
     #   by a new document uploaded by the current user.
     self.freezeTemplate = freezeTemplate
     # If p_template contains more than 1 template, "maxPerRow" tells how
     # much templates must appear side by side.
     self.maxPerRow = maxPerRow
     # The context is a dict containing a specific pod context, or a method
     # that returns such a dict.
     self.context = context
     # A global styles mapping that would apply to the whole template
     self.stylesMapping = stylesMapping
     # What are the output formats when generating documents from this pod ?
     self.formats = formats
     if not formats: # Compute default ones
         self.formats = self.getAllFormats(self.template[0])
     # Parameter "getChecked" can specify the name of a Ref field belonging
     # to the same gen class. If it is the case, the context of the pod
     # template will contain an additional object, name "_checked", and
     # "_checked.<name of the Ref field>" will contain the list of the
     # objects linked via the Ref field that are currently selected in the
     # user interface.
     self.getChecked = getChecked
     # Mailing lists can be defined for this pod field. For every visible
     # mailing list, a menu item will be available in the user interface and
     # will allow to send the pod result as attachment to the mailing list
     # recipients. Attribute p_mailing stores a mailing list's id
     # (as a string) or a list of ids.
#.........这里部分代码省略.........
开发者ID:dpineiden,项目名称:gestion_docs,代码行数:103,代码来源:pod.py


注:本文中的appy.fields.Field.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。