zcml:condition 的有效条件是什么?
ZCML 可以包含以下形式的条件指令:
<configure zcml:condition="installed some.python.package">
(conditional configuration directives)
</configure>
condition
的表达式语法是什么?允许“或”吗?
ZCML can include conditional directives of the form
<configure zcml:condition="installed some.python.package">
(conditional configuration directives)
</configure>
What is the expression syntax for condition
? Is 'or' allowed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也总是要查一下这个。语法非常简单,恐怕
or
不是语法的一部分。正如您可以从 zope.configuration 源代码中的文档,语法始终采用
verb argument
形式,其中 verb 是have、<代码>未安装、<代码>已安装和<代码>未安装。
have
和not-have
测试已注册的功能。注册的功能只是一个使用
标记注册的不透明字符串。使用它来标记某些内容已被包含,而不将其绑定到特定的实现。示例:已安装
和未安装
只需尝试导入指定的包;如果导入成功,installed
测试也会成功。例子:I always have to look this up too. The syntax is very simple, and
or
is not part of the syntax, I am afraid.As you can see from the documentation in the zope.configuration source code, the syntax is always of the form
verb arguments
, where verb is one ofhave
,not-have
,installed
andnot-installed
.have
andnot-have
test for a registered feature. A registered feature is simply an opaque string that has been registered with a<meta:provides feature="something" />
tag. Use it to flag that something has been included without tying it to a particular implementation. Example:installed
andnot-installed
simply try to import the named package; if the import succeeds so does theinstalled
test. Example: