TALES表达式

TALES表达式
本帖最后由 adam(三人行) 于 2011-9-3 16:55 编辑

TALES表达式介绍Zope的对象发布原理和TALES表达式
动态表达式:TALES = 模板属性语言表达式
最早仅仅用于Zope页面模板

包括三种形式:
Python 表达式

路径 表达式

string 表达式




Python表达式
python:25/5;python:context.title;python:context.absolute_url();python:context.files.objectValues();python:widget.type == 'gear';python:test(name=='Anonymous User', 'need to log in', default)
路径表达式使用对象发布规则定位和执行对象:
context/title;context/absolute_url;container/files/objectValues;user/getUserName;container/master.html/macros/header;request/form/address;root/standard_look_and_feel.html;request/form/x | context/x
路径表单式的扩展
not

nocall

exists


not路径表达式not:here/objectIds
nocall路径表达式nocall:here/aDocnocall:modules/string/join
exists路径表达式exists:request/form/errmsg
字符串表达式${} 中为路径表达式:
string:Just text. There's no path here.string:copyright $year, by me.string:Three ${vegetable}s, please.string:Your name is ${user/getUserName}!注意:portal_actions中的设置
高级的Python表达式python:widget.type == 'gear'python:test(name=='Anonymous User', 'need to log in', default)python:path('here/%s/thing' % foldername)python:path(string('here/$foldername/thing'))python:path('request/form/x') or default
小节: TALES
三种基本形式: python, path, string

路径的扩展:nocall, exists, not




设置