How do you serve a 'dynamic' file where the filename 
is not known at application start? I have tried 

class MainDirectory(Directory):
   _q_exports = ["", ..... ]

   def _q_index(self):
       if not hasattr(self, str("dynamicfiles")):
          self.dynamicfiles = []
          # Entries are of the form (urlname, fullpathfilename)
          # Deletion of entries done by other routines

   def _q_lookup [html] (self, component):
        print "@@@ component = ", str(component)

        for (urlname, filename)  in self.dynamicfiles:
            print "@@@ filename = ", filename
            if str(component) == urlname:
               return StaticFile(filename)()
               
    def dynamicfile(self, urlname, fullpathfilename):
        print "@@@ appending dynamic file"
        if not hasattr(self, str("dynamicfiles")):
           self.dynamicfiles = []
        self.dynamicfiles.append((urlname, fullpathfilename))
        print "@@@ redirecting ", str(get_path(1)) + urlname
        redirect(str(get_path(1)) + str("/") + urlname)

This only handle urlname  without a "/". One can write _q_traverse()
for handling this case.  The urlname is mapped to the fullpathfilename.
I don't know if the code is reliable.

Ernie
_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users

Reply via email to