Re: [Zope] dtml-with syntax question

2000-10-13 Thread Geoffrey L. Wright

Tim Cook writes:

  I'm sure someone will correct me if I'm wrong. But I believe you
  want:
  
  dtml-with "_.getitem(attribute3)"

Haven't tried it in my code yet, but thanks to your post I found the
section about _.getitem().  That'll come in handy all over the place,
so many thanks for the pointer!


//glw

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Computed attribute access (was: [Zope] dtml-with syntax question)

2000-10-12 Thread Dieter Maurer

Geoffrey L. Wright writes:
  I think I am finally getting a decent handle on namespace issues in
  Zope, and I can now with the dtml-with tag with reasonable efficacy in
  simple situations. But I have run into something of a brick wall on
  one issue.
  
  What I would like to be able to do is something like this:
  
  dtml-with objectName1
   dtml-var attribute1
   dtml-var attribute2
   dtml-var attribute3
   dtml-with folder.subFolder.objectName2
  dtml-var attribute1
   /dtml-with
  /dtml-with
  
  Where objectName2 is actually an attribute of objectName1.
It seems (though it is not clear) that you want a
computed attribute access?

   Your "objectName2" is an attribute of "objectName1"
   and contains the "id" of an object in "folder.subfolder"?

Then, you use "_.getattr". That's for accessing an attribute
you have the name for (and the name is not constant).

In your case, you would use it as:

dtml-with "_.getattr(folder.subFolder,objectName2)"


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] dtml-with syntax question

2000-10-12 Thread \Geoffrey L. Wright\ Geoffrey L. Wright

Chris Withers writes:
  "Geoffrey L. Wright" wrote:
   
   Where objectName2 is actually an attribute of objectName1.
  
  
   dtml-with objectName1
   dtml-var attribute1
   dtml-var attribute2
   dtml-var attribute3
   dtml-with objectName2
  dtml-var attribute1
   /dtml-with
   /dtml-with
  
  The above should now work...
  
  ...if it doesn't please explain in what way ;-)
 
Hmmm...  OK.  Here is my relevant code, complete with resulting error message:

dtml-with sidebar_item

  dtml-var attribute1
  dtml-var attribute2
  etc...
 
  dtml-with gsi_content
dtml-with inventory
  dtml-with attribute3
dtml-var short_desc
  /dtml-with
/dtml-with
  /dtml-with

/dtml-with sidebar_item

And Zope sez:

  Error Type: KeyError
  Error Value: short_desc

attribute1, attribute2 and attribute3 are all attributes of
sidebar_item.  If I change the dtml-with attribute3 to read 
dtml-with weepee_the_weewee (where weepee_the_weewee is the actual
name of the object I'm trying to refer to), then  I see the short_desc
attribute of weepee_the_weewee perfectly.

Don't I have to do something in my syntax to indicate that I'm looking
for the the value of attribute3 rather than an object with the literal
id "attribute3"?

  cheers,
  
  Chris

Dazed  Confused,

//glw

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] dtml-with syntax question

2000-10-12 Thread Tim Cook

"\"Geoffrey L. Wright\"

 Don't I have to do something in my syntax to indicate that I'm looking
 for the the value of attribute3 rather than an object with the literal
 id "attribute3"?

I'm sure someone will correct me if I'm wrong. But I believe you
want:

dtml-with "_.getitem(attribute3)"
 

-- Tim Cook --
Cook Information Systems | Office: (901) 884-4126 8am-5pm CDT
Free Practice Management 
Project Coordinator http://www.freepm.org
OSHCA Founding Supporter http://www.oshca.org

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] dtml-with syntax question

2000-10-11 Thread Geoffrey L. Wright

So here's a question from a fairly new Zope developer:

I think I am finally getting a decent handle on namespace issues in
Zope, and I can now with the dtml-with tag with reasonable efficacy in
simple situations. But I have run into something of a brick wall on
one issue.

What I would like to be able to do is something like this:

dtml-with objectName1
dtml-var attribute1
dtml-var attribute2
dtml-var attribute3
dtml-with folder.subFolder.objectName2
   dtml-var attribute1
/dtml-with
/dtml-with

Where objectName2 is actually an attribute of objectName1.


I figure I _should_ be able to do this, and I'm sure I'm missing
something obvious.  But I spent about a half hour scanning the
Zope.org site and the list archives and can't find an obvious example
of this.

Any thoughts, hints or HOWTOs?



Thanks!


//glw

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )