當前位置: 首頁>>代碼示例>>Python>>正文


Python Field.ZMIField類代碼示例

本文整理匯總了Python中Products.Formulator.Field.ZMIField的典型用法代碼示例。如果您正苦於以下問題:Python ZMIField類的具體用法?Python ZMIField怎麽用?Python ZMIField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ZMIField類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_value

  def get_value(self, id, **kw):
    if id in self.widget.property_names:
      return ZMIField.get_value(self, id, **kw)
    if not self.is_delegated(id):
      original_template_field = self.getRecursiveTemplateField()
      function = getOriginalGetValueFunction(original_template_field, id)
      if function is not None:
        return function(self, id, **kw)
      else:
        return ZMIField.get_value(self, id, **kw)

    field = self
    proxy_field = self.getTemplateField()
    REQUEST = kw.get('REQUEST', get_request())
    if proxy_field is not None and REQUEST is not None:
      field = REQUEST.get(
        'field__proxyfield_%s_%s_%s' % (self.id, self._p_oid, id),
        self)
      REQUEST.set(
        'field__proxyfield_%s_%s_%s' % (proxy_field.id, proxy_field._p_oid, id),
        field)

    # Don't use cache if field is not stored in zodb, or if target field is
    # defined by a TALES
    if self._p_oid is None or self.tales['field_id'] or self.tales['form_id']:
      return self._get_value(id, **kw)
      # XXX: Are these disabled?
      proxy_field = self.getTemplateField(cache=False)
      if proxy_field is not None:
        return proxy_field.get_value(id, **kw)
      else:
        return None

    cache_id = ('ProxyField.get_value',
                self._p_oid,
                field._p_oid,
                id)

    from Products.ERP5Form.Form import field_value_cache
    try:
      value = field_value_cache[cache_id]
    except KeyError:
      # either returns non callable value (ex. "Title")
      # or a FieldValue instance of appropriate class
      value, cacheable = self.getFieldValue(field, id, **kw)
      if cacheable:
        field_value_cache[cache_id] = value

    if value is _USE_ORIGINAL_GET_VALUE_MARKER:
      return proxy_field.get_value(id, **kw)

    if callable(value):
      return value(field, id, **kw)
    return value
開發者ID:poses,項目名稱:erp5,代碼行數:54,代碼來源:ProxyField.py

示例2: _edit

 def _edit(self, result):
     if result.has_key("captcha_type"):
         # Now, find out the old fields and wipe them out !
         new_provider = CaptchaProviderFactory.getProvider(result["captcha_type"])
         old_propertiesIds = self.__extraPropertyList
         new_properties = [x.get_real_field() for x in new_provider.getExtraPropertyList()]
         deleted_properties = [x for x in new_properties if not x.id in old_propertiesIds]
         for deleted_property in deleted_properties:
             if deleted_property.values.has_key("default"):
                 result[deleted_property.id] = deleted_property.values["default"]
             else:
                 result[deleted_property.id] = None
         self.__extraPropertyList = new_properties
     ZMIField._edit(self, result)
開發者ID:smetsjp,項目名稱:erp5,代碼行數:14,代碼來源:CaptchaField.py

示例3: get_value

 def get_value(self, id, **kw):
   if id=='default' and kw.get('render_format') in ('list', ):
     return self.widget.render(self, self.generate_field_key(), None,
                               kw.get('REQUEST'),
                               render_format=kw.get('render_format'))
   else:
     return ZMIField.get_value(self, id, **kw)
開發者ID:Verde1705,項目名稱:erp5,代碼行數:7,代碼來源:MatrixBox.py

示例4: paralellListFieldGetValue

def paralellListFieldGetValue(field, id, REQUEST=None, **kw):
  result = MARKER
  key = KEYWORD % id
  if REQUEST is not None and REQUEST.has_key(key):
    result = REQUEST.get(key)
  if result is MARKER:
    result = ZMIField.get_value(field, id, REQUEST=REQUEST, **kw)
  return result
開發者ID:MarkTang,項目名稱:erp5,代碼行數:8,代碼來源:ParallelListField.py

示例5: getCaptchaCustomTalesPropertyList

 def getCaptchaCustomTalesPropertyList(self):
     if hasattr(self, "__extraTalesPropertyList"):
         return self.__extraTalesPropertyList
     captcha_type = ZMIField.get_value(self, "captcha_type")
     captcha_provider = CaptchaProviderFactory.getProvider(captcha_type)
     extraPropertyList = captcha_provider.getExtraTalesPropertyList()
     self.__extraTalesPropertyList = [x.id for x in extraPropertyList]
     return extraPropertyList
開發者ID:smetsjp,項目名稱:erp5,代碼行數:8,代碼來源:CaptchaField.py

示例6: get_orig_value

 def get_orig_value(self, id):
   """
   Get value for id; don't do any override calculation.
   """
   if id in ('is_relation_field', 'is_multi_relation_field'):
     result = 1
   else:
     result = ZMIField.get_orig_value(self, id)
   return result
開發者ID:MarkTang,項目名稱:erp5,代碼行數:9,代碼來源:MultiRelationField.py

示例7: _get_user_input_value

 def _get_user_input_value(self, key, REQUEST):
   """
   Try to get a value of the field from the REQUEST
   """
   proxy_field = self.getTemplateField()
   if proxy_field is not None:
     result = proxy_field._get_user_input_value(key, REQUEST)
   else:
     result = ZMIField._get_user_input_value(self, key, REQUEST)
   return result
開發者ID:poses,項目名稱:erp5,代碼行數:10,代碼來源:ProxyField.py

示例8: get_value

  def get_value(self, id, REQUEST=None, **kw):
    """Get value for id.

    Optionally pass keyword arguments that get passed to TALES
    expression.
    """
    if (id == 'items') and (REQUEST is not None):
      # relation_item_list is not editable for the RelationField
      result = REQUEST.get('relation_item_list', None)
    else:
      result = ZMIField.get_value(self, id, REQUEST=REQUEST, **kw)
    return result
開發者ID:MarkTang,項目名稱:erp5,代碼行數:12,代碼來源:MultiRelationField.py

示例9: has_value

 def has_value(self, id):
     """
 Return true if the field defines such a value.
 """
     result = None
     if (id in self.widget.property_names) or (not self.is_delegated(id)):
         result = ZMIField.has_value(self, id)
     else:
         proxy_field = self.getTemplateField()
         if proxy_field is not None:
             result = proxy_field.has_value(id)
     return result
開發者ID:esosaja,項目名稱:erp5,代碼行數:12,代碼來源:ProxyField.py

示例10: getCaptchaCustomTalesPropertyList

 def getCaptchaCustomTalesPropertyList(self):
   captcha_type = ZMIField.get_value(self, "captcha_type")
   captcha_provider = CaptchaProviderFactory.getProvider(captcha_type)
   extraPropertyList = captcha_provider.getExtraTalesPropertyList()
   return extraPropertyList                                     
開發者ID:jerome-nexedi,項目名稱:erp5,代碼行數:5,代碼來源:CaptchaField.py

示例11: get_value

 def get_value(self, id, **kw):
   if id in self.getCaptchaCustomPropertyList():
     return self.values[id]
   return ZMIField.get_value(self, id, **kw)
開發者ID:jerome-nexedi,項目名稱:erp5,代碼行數:4,代碼來源:CaptchaField.py

示例12: __init__

 def __init__(self, id, **kw):
     ZMIField.__init__(self, id, **kw)
     PythonScript.__init__(self, id)
開發者ID:Provab-Solutions,項目名稱:erp5,代碼行數:3,代碼來源:ZPyChart.py

示例13: get_orig_value

 def get_orig_value(self, id):
   """Get value for id; don't do any override calculation.
   """
   if id not in self.widget.property_names and self.is_delegated(id):
     return self.getTemplateField().get_orig_value(id)
   return ZMIField.get_orig_value(self, id)
開發者ID:poses,項目名稱:erp5,代碼行數:6,代碼來源:ProxyField.py


注:本文中的Products.Formulator.Field.ZMIField類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。