小编rod*_*sou的帖子

如何在本地运行archetypes.querywidget测试套件?

我需要在archetypes.querywidget上修复它,它的buildout不是创建bin/test脚本.

我应该使用buildout.coredev吗?我需要更改它的结帐才能运行测试吗?

testing plone

5
推荐指数
1
解决办法
30
查看次数

使用Archetypes从RichText字段获取文本的规范方法是什么?

对于Dexterity内容类型,规范的方法是使用变换器:

from plone.app.textfield.interfaces import ITransformer
from plone.app.textfield.value import IRichTextValue


def get_text_field(obj):
    """Get text field in object on Dexterity."""
    transformer = ITransformer(obj)
    text = ''
    if IRichTextValue.providedBy(obj.text):  # Dexterity
        text = transformer(obj.text, 'text/plain')
    return text
Run Code Online (Sandbox Code Playgroud)

但是我找不到规范的方法来做Archetypes,变换器不能用rawhtml,只是用RichTextValue对象.

我现在的方法是使用lxml.html将html转换为文本,但我不知道它是否像它应该的那样工作:

def get_text_field(obj):
    """Get text field in object on both, Archetypes and Dexterity."""
    text = ''
    try:
        raw = obj.getText()  # Archetypes
        if raw != '':
            from lxml import html
            el = html.fromstring(raw)
            text = …
Run Code Online (Sandbox Code Playgroud)

plone archetypes

3
推荐指数
1
解决办法
293
查看次数

如何以编程方式注册浏览器层

我知道可以使用GenericSetup和一个XML文件注册浏览器层,但我需要以编程方式进行注册.

这可能吗?

plone genericsetup

2
推荐指数
1
解决办法
83
查看次数

标签 统计

plone ×3

archetypes ×1

genericsetup ×1

testing ×1