Zope / DTML真气...... [英] Zope/DTML Infuriating...
问题描述
大家好。
我对Zope比较陌生(用它来做工作项目)我想知道这里是否有人可以帮助我或者至少将我推荐给Zope / DTML / Python的一个体面的文档(在
php.net或Java API参考的详细级别)。 http://www.zope.org/Documentation/Bo .. .ok / 2_6Edition /
对我的口味并不是很详细。如果它没有包含所有可用基类的详尽描述,那么它就不是
作为参考资源。
>
无论如何,我有以下问题。我正在使用zope 2.9而且我会希望以下dtml代码产生一个包含main1,main2
等的列表。
< dtml-let prefix ="''main''">
< ul>
< dtml-in expr =" _.range(1,10)">
< li>< dtml-var expr =" _ [''prefix''] + _ [''sequence-item' ']">< / li>
< / dtml-in>
< / ul>
< / dtml-let>
但是它不起作用(是的,我知道我可以简单地做......< dtml-
var prefix>< dtml-var sequence-item> ...",但那不是我需要的。)
我已经检查过我指的是变量是正确的,所以
唯一的解释是我能想到的,'+''不会导致
字符串连接(隐式类型转换)到整数的字符串
变量(这是一个解释性的语言毕竟年龄))。显然
适用于其他情况,但由于某种原因不在这里。我收到以下
密码错误消息,这让我更聪明。
发布此资源时遇到错误。
>
错误类型:AttributeError
错误值:''NoneType''对象没有属性''group''
我将不胜感激任何您可能对此有任何反馈。谢谢
提前。
Hello Everyone.
I am relatively new to Zope(using it for a work project) and I was
wondering if someone here could help me out or at least refer me to a
decent documentationg for Zope/DTML/Python (at the detail level of
php.net or Java API reference). http://www.zope.org/Documentation/Bo...ok/2_6Edition/
isn''t really detailed enough for my taste. if it doesn''t contain a
exhautive description of all available base classes it''s simply no
good as a reference resource.
Anyway I have the following problem. I''m using zope 2.9 and I would
expect the following dtml code to yield a list containing main1, main2
etc.
<dtml-let prefix="''main''">
<ul>
<dtml-in expr="_.range(1,10)">
<li><dtml-var expr="_[''prefix''] + _[''sequence-item'']"></li>
</dtml-in>
</ul>
</dtml-let>
But it doesn''t work(and yes i know that i could simply do "... <dtml-
var prefix><dtml-var sequence-item>...", but that''s not what i need).
I''ve the checked that i''m referring to the variables correctly, so the
only explanation i can come up with, is that ''+'' doesn''t result in a
string concatenation (with implicit typecast to string of the integer
variable(this is a interpreted language after all)). It apparently
works in other cases but for some reason not here. I get the following
cryptical error message which makes me none the wiser.
An error was encountered while publishing this resource.
Error Type: AttributeError
Error Value: ''NoneType'' object has no attribute ''group''
I would appreciate any feedback you might have regarding this. Thanks
in Advance.
推荐答案
Jens写道:
Jens wrote:
我已经检查过我正确引用了变量,所以
我能想出的唯一解释是,'+''不会导致a
字符串连接(使用隐式类型转换为整数字符串
变量(毕竟这是一种解释语言))。
I''ve the checked that i''m referring to the variables correctly, so the
only explanation i can come up with, is that ''+'' doesn''t result in a
string concatenation (with implicit typecast to string of the integer
variable(this is a interpreted language after all)).
不,对不起。你至少需要阅读python教程。
你可能从以前的PHP经验中得到了错误的假设。
No, sorry. You really need to read the python tutorial at the very least.
You might have wrong assumptions from previous PHP experiences.
>>''x''+ 4
>>''x''+4
Traceback(最近一次调用最后一次):
文件"< stdin>",第1行,在< module>中
TypeError:无法连接''str''和''int''对象
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot concatenate ''str'' and ''int'' objects
>>>
>>>
4月29日,1:59 * pm,Marco Mariani< ma ... @ sferacarta.comwrote:
On Apr 29, 1:59*pm, Marco Mariani <ma...@sferacarta.comwrote:
Jens写道:
Jens wrote:
我已经检查过我指的是变量正确的,所以
只有我能想出的解释是,'+''不会导致
字符串连接(隐式类型转换为字符串整数
变量(毕竟这是一种解释语言))。
I''ve the checked that i''m referring to the variables correctly, so the
only explanation i can come up with, is that ''+'' doesn''t result in a
string concatenation (with implicit typecast to string of the integer
variable(this is a interpreted language after all)).
不,对不起。你至少需要阅读python教程。
你可能从以前的PHP经验中得到了错误的假设。
*>>'' x''+ 4
回溯(最近一次调用最后一次):
* *文件"< stdin>",第1行,< module>
TypeError:无法连接''str''和''int''对象
*>
No, sorry. You really need to read the python tutorial at the very least.
You might have wrong assumptions from previous PHP experiences.
*>>''x''+4
Traceback (most recent call last):
* *File "<stdin>", line 1, in <module>
TypeError: cannot concatenate ''str'' and ''int'' objects
*>
...并且非势利答案应该是:
...< dtml-var expr = " _ [''前缀''] + str(_ [''sequence-item''])">
... and the non snobby answer would have been:
... <dtml-var expr="_[''prefix''] + str(_[''sequence-item''])">
4月29日,1:59 * pm,Marco Mariani< ma ... @ sferacarta.comwrote:
On Apr 29, 1:59*pm, Marco Mariani <ma...@sferacarta.comwrote:
Jens写道:
Jens wrote:
我已经检查过我正确引用了变量,所以
我能想出的唯一解释是''+''不会导致
字符串连接(使用隐式类型转换为整数字符串
变量(毕竟这是一种解释语言))。
I''ve the checked that i''m referring to the variables correctly, so the
only explanation i can come up with, is that ''+'' doesn''t result in a
string concatenation (with implicit typecast to string of the integer
variable(this is a interpreted language after all)).
不,对不起。你至少需要阅读python教程。
你可能从以前的PHP经验中得到了错误的假设。
*>>'' x''+ 4
回溯(最近一次调用最后一次):
* *文件"< stdin>",第1行,< module>
TypeError:无法连接''str''和''int''对象
*>
No, sorry. You really need to read the python tutorial at the very least.
You might have wrong assumptions from previous PHP experiences.
*>>''x''+4
Traceback (most recent call last):
* *File "<stdin>", line 1, in <module>
TypeError: cannot concatenate ''str'' and ''int'' objects
*>
...并且非势利答案应该是:
...< dtml-var expr = " _ [''前缀''] + str(_ [''sequence-item''])">
... and the non snobby answer would have been:
... <dtml-var expr="_[''prefix''] + str(_[''sequence-item''])">
这篇关于Zope / DTML真气......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!