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


Python ObjectField.get方法代码示例

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


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

示例1: get

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
 def get(self, instance, **kwargs):
     value = ObjectField.get(self, instance, **kwargs)
     if type(value) in types.StringTypes:
         # migration from TextField
         zpt = ZopePageTemplate(self.getName())
         ObjectField.set(self, instance, zpt, **kwargs)
         value = ObjectField.get(self, instance, **kwargs)
     return value.pt_render(extra_context={'options': kwargs})
开发者ID:dtgit,项目名称:dtedu,代码行数:10,代码来源:_field.py

示例2: get

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
 def get(self, instance, **kwargs):
     value = ObjectField.get(self, instance, **kwargs)
     if type(value) in types.StringTypes:
         # migration from TextField
         zpt = ZopePageTemplate(self.getName())
         ObjectField.set(self, instance, zpt, **kwargs)
         value = ObjectField.get(self, instance, **kwargs)
     if config.CATCH_RENDER_ERRORS:
         try:
             return value.pt_render(extra_context={'options': kwargs})
         except Exception, e:
             return _(u"zpt_field_render_error",
                      default=u'<div class="error">An error occured while rendering this field</div>')
开发者ID:Vinsurya,项目名称:Plone,代码行数:15,代码来源:_field.py

示例3: getRaw

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
 def getRaw(self, instance, **kwargs):
     body = ObjectField.get(self, instance, **kwargs).body()
     p1 = body.find(self._seperator)
     if p1 == -1:
         # no seperator: we return the whole body
         return body
     else:
         p1 = p1 + len(self._seperator)
         p2 = body.find(self._seperator, p1)
         return body[p1:p2]
开发者ID:dtgit,项目名称:dtedu,代码行数:12,代码来源:_field.py

示例4: getRaw

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
    def getRaw(self, instance, aslist=False, **kwargs):
        """Return the list of UIDs referenced under this fields
        relationship
        """
        objects = []
        uids = ObjectField.get(self, instance, **kwargs)

        if uids is None:
            uids = []

        if not self.multiValued and not aslist:
            if uids:
                uids = uids[0]
            else:
                uids = None
        return uids
开发者ID:rochecompaan,项目名称:upfront.simplereferencefield,代码行数:18,代码来源:simplereferencefield.py

示例5: get

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
    def get(self, instance, aslist=False, **kwargs):
        """
        """
        res = ObjectField.get(self, instance, **kwargs)
        if res is None:
            return res

        if self.multiValued:
            resolved = []
            for rel in res:
                resolved.append(rel.to_object)
        else:
            resolved = res.to_object
            if aslist:
                resolved = [resolved]

        return resolved
开发者ID:dbrenneman,项目名称:archetypes.z3crelationfield,代码行数:19,代码来源:field.py

示例6: get

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
    def get(self, instance, aslist=False, **kwargs):
        objects = []
        rc = getToolByName(instance, REFERENCE_CATALOG)
        uids = ObjectField.get(self, instance, **kwargs)

        if uids is None:
            uids = []

        for uid in uids:
            if uid:
                objects.append(rc.lookupObject(uid))

        if objects:
            if not self.multiValued:
                return objects[0]
            else:
                return objects

        return []
开发者ID:rochecompaan,项目名称:upfront.simplereferencefield,代码行数:21,代码来源:simplereferencefield.py

示例7: get

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
 def get(self, instance, **kwargs):
     zpt = ObjectField.get(self, instance, **kwargs)
     return zpt.pt_render(extra_context={'options': kwargs})
开发者ID:a25kk,项目名称:stv2,代码行数:5,代码来源:_field.py

示例8: getRaw

# 需要导入模块: from Products.Archetypes.public import ObjectField [as 别名]
# 或者: from Products.Archetypes.public.ObjectField import get [as 别名]
 def getRaw(self, instance, **kwargs):
     dtml = ObjectField.get(self, instance, **kwargs)
     return dtml.read()
开发者ID:a25kk,项目名称:stv2,代码行数:5,代码来源:_field.py


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