[Zope] arrgghhh syntactical hell!!

Dieter Maurer dieter@handshake.de
Wed, 21 Nov 2001 23:42:23 +0100


Jacob Singh writes:
 > I have an SQL query which pulls a record from a database.  One of the
 > fields is called file1.  It contains a path to a file (i.e.
 > media/inline/asdasd.jpeg).  This file is accessible through LocalFS.
 > LocalFS requires a syntax like media['inline']['asdasd.jpg'], so I wrote
 > a script to convert the Unix style path to something LocalFS can
 > understand.  This works fine.  Here is the code I use in my DTML doc to
 > render asdasd.jpg:
 > 
 > <dtml-call expr="REQUEST.set('imgpath',makeLocalFSPath(file1))">
 > <dtml-var "_.getitem(imgpath,1)" null="_[media['none.gif']]">
You will not believe how often I have already answered questions like yours:

    Use "restrictedTraverse"!


Dieter