tcl-websh-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronnie Brunner <ron...@netcetera.ch>
Subject Re: web::config for mod_websh paths
Date Fri, 03 May 2002 15:45:57 GMT
> I have .ws3 files, set up, of course, with mod_websh.  What I would
> like to do is to automate the loading of websh.com.gen for everything
> in a certain directory.  I don't want that file loaded for every .ws3
> file I request, though, because it might interfere with other things I
> am testing.

Your .ws3 file are either code or templates. (meaning the .ws3 file
needs be eval'd or web::putxfile'd). The setup is a little different
in both cases. The easier case is code files:


  wep::interpmap {file} {

     # what needs to be passed to websh.com.gen
     if {[match_websh.com.gen $file]} {
        return /path/to/websh.com.gen
     }
     # default (all other files use their own class)
     return $file  
  }

Note: for this to work, match_websh.com.gen is a proc that finds out
whether it is a request that must include websh.com.gen using some
pattern match or regex or similar and the websh.com.gen script must do
the following (at the end of the code)

  # all stuff in websh.com.gen
  # ...

  web::include [web::config script]
  # EOF
    
The setup for template files would be

  wep::interpmap {file} {

     # what needs to be passed to websh.com.gen
     if {[match_websh.com.gen $file]} {
        return /path/to/websh.com.gen
     }
     # default (all other files use their own class)
     return /path/to/defaulthandler
  }

where match_websh.com.gen is the same as above, but the websh.com.gen
script must look something like

  # all stuff in websh.com.gen
  # ...

  web::putxfile [web::config script]
  # EOF


and the defaulthandler script looks something like

  # this is the default handler
  web::putxfile [web::config script]
  # EOF


You can actually mix the approach for each interpreter class you
define, but this could be confusing. A better solution would be to add
a second handler, such as a handler for .whtml (templates) and a
handler for .ws3 (scripts) using the following generic interpmap setup:

  wep::interpmap {file} {

     # scripts
     if {[string match *.ws3 $file]} {
         # they all have their own interp class
         return $file
     }

     # templates (i.e. all *.whtml files)
     return /path/to/defaulthandler
  }

where the defaulthandler is essentialy a [web::putxfile [web::config script]]
command, just as above.

Ronnie
------------------------------------------------------------------------
Ronnie Brunner                               ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich    phone +41 1 247 79 79 Fax: +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Mime
View raw message