You are not logged in Log in Join
You are here: Home » Members » ivo » tag product » dc_view

Log in
Name

Password

 
 


Dublin Core Elements

The Dublin Core metadata element set is a standard for cross-domain information resource description.
Element Description Value
Identifier resource ID http://old.zope.org/Members/ivo/SetTag
Title resource name <dtml-set> tag product
Description resource summary dtml-set (c) Ivo van der Wijk, Amaze Internet Services ([email protected]) What does it do? ---------------- This product implements a <dtml-set> tag that enables dtml coders to set variables transparently. It basically replaces those ugly (and error prone) <dtml-call "REQUEST.set(foo, 10)"> calls. It also provides an 'optional' tag, which will only do the assignment if the target variable previously didn't exist, previously equivalent to: <dtml-unless foo> <dtml-call "REQUEST.set(foo, 10)"> </dtml-unless> Why not dtml-let? ----------------- dtml-let requires a block, which can be usefull to keep the changed namespace local and clean, but it makes it really hard to make a variable available in your entire dtml document/method. Why not dtml-eval? ------------------ dtml-eval (another similar external product) requires a block structure. Assignments within this blockstructure are global within your dtml document/ method, but I like the shorter dtml-set notation. Also, it lacks the 'optional' tag. Examples -------- - set some variables <dtml-set i="20" j="somePythonMethod(10,20)"> <dtml-set q=j> (assigns previously set j to q) <dtml-set name="'John Doe'" optional> (only assings if name was undefined) <dtml-set i="20"> <dtml-set j="i+5"> <dtml-var j> (will print 25) Pitfalls --------- Assigning a string has to be done using a python expression, which has to be enclosed in "", i.e. <dtml-set my_str="'Hello world'"> dtml-set is not limited by the scope of other tags, i.e. <dtml-let foo=5> <dtml-set bar=foo> </dtml-let> <dtml-var bar> Will work fine. TODO list --------- - Some code cleanups, regular expression optimizations - Rewrite this document in structured text format - <dtml-set optional> works without warning. - the behaviour is undefined if 'optional' is not placed at the end.
Creator resource creator ZopeOrgSite
Date default date 2001-07-19 05:43:39
Format resource format text/html
Type resource type Software Package
Subject resource keywords Developer, Visual
Contributors resource collaborators
Language resource language
Publisher resource publisher No publisher
Rights resource copyright


Additional Zope Elements

Element Description Value
CreationDate date resource created 2001-07-19 05:43:39
ModificationDate date resource last modified 2001-07-19 05:43:39
EffectiveDate date resource becomes effective None
ExpirationDate date resource expires None

Backlinks: via Google / Technorati