How to get the "section" argument in a custom HandlerTool

"'Alexander Krause' via cherrypy-users" <cherrypy-users-/[email protected]> Thu, 27 Apr 2017 09:27:23 -0700 (PDT)
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Hi there!

I'm trying to implement a static handler which serves files from a zip.

So I started with writing my own "staticdir()" and I've registered it via 

cherrypy.tools.zip_staticdir = cherrypy._cptools.HandlerTool(staticdir)



First of all I'm wondering while:
cherrypy.tools.zip_staticdir = cherrypy.HandlerTool(staticdir)

does not work, but
cherrypy.tools.zip_staticdir = cherrypy.Tool(staticdir)

does.


So anyway, the biggest issue is that I need to get the section argument 
like the default staticdir function is called because my setup looks 
somehow like this:
 conf = {
   '/images': {
     'tools.zip_staticdir.on': True,
     'tools.zip_staticdir.zobj': self._core.ZipFile,
     'tools.zip_staticdir.dir': os.path.join(...)
   },
   '/js': {
     'tools.zip_staticdir.on': True,
     'tools.zip_staticdir.zobj': self._core.ZipFile,
     'tools.zip_staticdir.dir': os.path.join(...)
   },
   '/css': {
     'tools.zip_staticdir.on': True,
     'tools.zip_staticdir.zobj': self._core.ZipFile,
     'tools.zip_staticdir.dir': os.path.join(...)
   },
 '/fonts': {
     'tools.zip_staticdir.on': True,
     'tools.zip_staticdir.zobj': self._core.ZipFile,
     'tools.zip_staticdir.dir': os.path.join(...)
   }
 }

cherrypy.tree.mount(self.internalApp, '/_/', config=conf)


def staticdir(*args,**kwargs):
  print(args,kwargs)




Thanks a lot for any helpful hints!

Regards,
Alex

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.