[Zope] where are you sticking site-wide methods/resources
? (too manyDTML-WITH's) DTML-WITH's)
chas
panda@skinnyhippo.com
Wed, 29 Sep 1999 18:37:06 +0800
At 08:38 AM 9/29/99 +0100, Phil Harris wrote:
>Couldn't you just do something like (untested)
>
><dtml-var "Imports.folder.method()">
>
>Would that help at all?
One of the first things I tried as I remember. Worked OK for
simple methods but for more complex methods :
a) variables kept disappearing (which means I really don't grok
this acquisition business yet).
b) the DTML method could no longer 'import' other things.
eg. /Imports
/FolderA
/method1
/FolderB
/method2
/ContentFolder
/index_html
index_html *can* call method1 using
<dtml-var "Imports.FolderA.method1()">
Now let method1 call method2 using
<dtml-var "Imports.FolderB.method2()">.
This works ok if method1 is viewed directly.
BUT when index_html calls method1, an error is
generated ... it seems that it can not in turn
call method2. (Doesn't recognise "Imports")
Otherwise, yeah, it would have helped.
chas
>-----Original Message-----
>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of chas
>Sent: Wednesday, September 29, 1999 8:46 AM
>To: zope@zope.org
>Subject: [Zope] where are you sticking site-wide methods/resources ?
>(too manyDTML-WITH's) DTML-WITH's)
>
>
>In the past 3 weeks I've reorganised my code as many times and
>I still haven't come to an optimal solution. So, may I ask :
>how are others doing this ?
>
>For example, I have 50+ DTML methods and 40+ external methods which
>are used throughout the site (I have many more of each which are
>specific to certain folders but they're not a problem.)
>The most convenient thing would be to stick these 'site-wide' methods
>in the root folder of Zope but then I had to scroll 2 pages to get to
>the pulldown menu and, basically, I didn't like it.
>
>So, I stuck all of these into a folder called /Imports and split
>them into further subfolders. Then I use
><DTML-WITH "Imports"><DTML-VAR methodname></DTML-WITH>
>or
><DTML-WITH "Imports.Subfolder"><DTML-VAR methodname></DTML-WITH>
>
>This caused quite a few headaches at first as variables disappeared
>often. But the biggest problem has been that my pages are so full
>of <DTML-WITH>'s that I'm losing a lot of the 'thoughtspace' (ie. I
>can't just look at a page and easily grok what it does - all I see is
>these WITH's) ... this bodes not well for a large, long term project.
>
>What I love about Python is that I can write
>
>import module1, module2, module3
>
>at the top of a script and be done with it. The rest of the code is
>then elegant and clean. The equivalent in DTML would be to put
><DTML-WITH Imports> into standard_html_header and </DTML-WITH>
>in the footer but obviously that is not possible because it
>would royally screw up the namespace/acquisition.
>
>Am I overlooking something here ?
>
>cheers,
>
>chas
>
>
>
>_______________________________________________
>Zope maillist - Zope@zope.org
>http://www.zope.org/mailman/listinfo/zope
>
>(To receive general Zope announcements, see:
>http://www.zope.org/mailman/listinfo/zope-announce
>
>For developer-specific issues, zope-dev@zope.org -
>http://www.zope.org/mailman/listinfo/zope-dev )
>
>_______________________________________________
>Zope maillist - Zope@zope.org
>http://www.zope.org/mailman/listinfo/zope
>
>(To receive general Zope announcements, see:
>http://www.zope.org/mailman/listinfo/zope-announce
>
>For developer-specific issues, zope-dev@zope.org -
>http://www.zope.org/mailman/listinfo/zope-dev )
>