Turbogears 2.3.10 error kajiki template with pluggable application

76 views Asked by At

I used turbogears 2.3.10 with kajiki template, I created applicantion name samples and created pluggable application name plugapp. (I see in http://turbogears.readthedocs.io/en/latest/turbogears/Pluggable/index.html?highlight=plugin)

I created package name master_view(templates/master_view) and file master.xhtml in plugapp(pluggable application).

 -plugapp
    --templates
        --master_view
            --master.xhtml
        --index.xhtml

In index.xhtml of plugapp(pluggable application), I changed

<py:extends href="master.xhtml"/> 

to

<py:extends href="master_view/master.xhtml"/>

I run http://localhost:8080/plugapp. it show error

TypeError: coercing to Unicode: need string or buffer, NoneType found .

How do I fix it? thank you.

1

There are 1 answers

0
amol On

The error can definitively be better, but what's trying to tell you is that there is no such template as when specified by a relative filename, the templates are looked up inside the templates directory. Which is the templates directory of the base application (as the base app configuration applies), not the template directory of the pluggable.

As the application where you are plugging the module into has no templates/master_view/master.xhtml file kajiki is unable to load it.

Whenever referring to something contained into a pluggable app, you should use the dotted notation. So that you can refer to the python package of the pluggable app.

In this case you want to create an __init__.py file inside your master_view directory and use py:extends="provaplug.templates.master_view.master" to load the expected master.html file.

As you are explicitly pointing to master_view/master.xhtml contained into the provaplug package (where provaplug is the name of your pluggable app) you will be loading the one of your pluggable app