[Zope] return value treated as dtml?

Dylan Reinhardt zope at dylanreinhardt.com
Fri Oct 24 12:35:10 EDT 2003


On Fri, 2003-10-24 at 07:40, Ted holden wrote:
> This is a text indexing and retrieval methodology and the assumption is that 
> an organization has a directory containing text files or some sort of files 
> with ascii text in them
<snip>
> Now, once that screen comes up (is returned by the application and displayed), 
> I'd like to have the user be able to click on one of the lines and thereby 
> execute a method which would read a couple of thousand bytes around the 
> indicated byte offset in the given file, and display them.  

OK.  Sounds like a Zope system so far.

> The problem is that once a screen like that returns, you're outside the 
> confines of zope and dtml.

Yep.  By the time that screen renders, you're waiting around for the
client to make their next request.  


>   Inside a dtml method, something like:
> 
> <a href=<dtml-call 'function('arg1', 'arg2')"> > first hit </a><br>
> 
> works well enough.  That's basically the kind of effect I need. 

Sounds workable... what is it about passing the user a correctly-formed
link that doesn't meet your needs?


> I'm guessing at this point that the best shot might be to write the list of 
> hits to a file, and then return a handle to a dtml file which would pick up 
> the list of hits from the file and do the right things with them, and include 
> the user's name or id in the name of the hit file to keep users separate.


I'm a bit confused at this. Is this a logging solution?  A caching
solution?  In terms of performance, it's tough to see how it could
possibly improve on knowing a file name and a byte offset.


> The question at that point would be whether an external method could return 
> the handle of a dtml method created within Zope

Sure.  The easiest thing to do is return a string that corresponds with
a dtml method (or anything) available in the current namespace. Ex:

<dtml-call "REQUEST.set('some_name', ext_method(arg1, arg2))">
<dtml-var "_[some_name]">

You could also grab a reference to a method, but it's not clear what
that could gain you in this situation.  Are you trying to embed dtml
tags in your text documents?  If so, why not just store them as dtml
methods in the ZMI?


>  or whether something like 
> dtmlfile could work outside of zclasses.

Well... you can create a DTML method anywhere in the ZMI.

Perhaps you want to use a Python script to coordinate the efforts of
DTML methods and external methods.  Honestly, I'm not entirely clear
what the goal is, so it's tough to say.

>   That's just a guess;  I'd be glad 
> to hear any suggestions.

Sorry I couldn't offer better ones.  Maybe some more detail about your
problem would help.

HTH,

Dylan




More information about the Zope mailing list