Search code examples
pythonplonediazo

"TypeError: make_staticdir() got an unexpected keyword argument 'document_root'" running Diazo through Proxy


I exactly followed the steps on the Diazo quickstart guide hosted at docs.plone.org (docs.diazo.org is out of date as I write this in April 2015) and received a strange error when I attempted to execute the final command bin/gearbox serve --reload -c proxy.ini. This error prevented me from continuing and did not indicate where it was coming from.

The precise error that I received was:

File "eggs/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
TypeError: make_staticdir() got an unexpected keyword argument 'document_root'

Does anyone know how I can resolve this issue in order to proceed in developing my Plone theme?


Solution

  • It turns out that this error is caused by a mistake in the proxy.ini file due to which a suppressed error is thrown in the webobentrypoints library. To correct this, please change the third section of proxy.ini entitled "app:static" to use "path" instead of the incorrect "document_root" such that it now contains the following:

    [app:static]
    use = egg:webobentrypoints#staticdir
    path = %(here)s/theme
    

    Once you fix this issue, however, you will still need to fix one more problem: the page that the quickstart guide attempts to proxy has changed such that it will redirect your browser and not display your theme. I had good luck switching the final section of proxy.ini to the latest version of the same document now hosted at plone.org:

    [app:content]
    use = egg:webobentrypoints#proxy
    address = http://docs.plone.org/external/diazo/docs/index.html
    suppress_http_headers = accept-encoding connection
    

    To properly theme this site you must now further modify the rules.xml file to render the class ".content-column" instead of ".content." It should look like:

    <rules
        xmlns="http://namespaces.plone.org/diazo"
        xmlns:css="http://namespaces.plone.org/diazo/css"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <theme href="theme/theme.html" />
    
        <drop css:content="#indices-and-tables" />
        <replace css:theme-children="#content" css:content-children=".content-column" />
    </rules>
    

    Hopefully this will fix your problem.

    Note: I have already submitted these changes for inclusion in the Diazo documentation but, especially given how many versions of the document can be easily found when looking around for help, it seems prudent to document this possible error in a central location.