Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #847 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

AutoCompleteField in master.kid doesn't work on non-root page

Reported by: andy@… Owned by: anonymous
Priority: normal Milestone: 1.0
Component: TG Widgets Version: 0.9a5
Severity: normal Keywords:
Cc: simon.belak@…


I have a search box (AutoCompleteField) that I want to have on every page, so I put it in the master.kid template. It works on / but not on any other pages.

Works:  http://bandradar.com

Doesn't work:  http://bandradar.com/events/list

Viewing source the reason is obvious: None of the .js needed is being included in <head> for non-root pages!

Here is the widget definition, and I will attach my master.kid:

class SearchBox(w.WidgetsList):
    search = w.AutoCompleteField(label="",

artist_search_form = w.ListForm(fields=SearchBox(), name="search",


master.kid Download (2.7 KB) - added by andy@… 13 years ago.

Change History

Changed 13 years ago by andy@…


comment:1 Changed 13 years ago by alberto

  • Status changed from new to closed
  • Resolution set to worksforme

Importing the form directly into your template shotcuts the mechanism by which widgets going to the template are "detected" and their css and js resources pulled out.

If you need a widget at master.kid you should write a var_upadater (take a look at turbogears.view for more info) that provides your widget instance as a template variable automatically.

Then you should be able to do in your template:


If this doesn't work please reopen the ticket. Alberto

comment:2 Changed 13 years ago by michele

I don't think variable_providers are inspected for widgets... :-(

We need to address such a scenario for 1.1... ticket at #692

comment:3 Changed 13 years ago by alberto

  • Status changed from closed to reopened
  • Resolution worksforme deleted

:(( I swear I thought they were.... :/ Then we should reopen this... or at least "merge" it with #692 I believe.

comment:4 Changed 13 years ago by michele

  • Cc simon.belak@… added

I think that it shouldn't be to difficult to inject what is inside variable_provider to be inspected when looking for retrieve_js/css since variable_provider is just a list.

For 1.1 we need a more powerful system, but in the meanwhile I think we can fix this small issue probably, need to look into controllers.py... or need to ping simon... :D

comment:5 Changed 13 years ago by jorge.vargas

  • Milestone set to 1.0

going to set this for 1.0 if noone fixes it by then we'll close and merge with #692

comment:6 Changed 13 years ago by alberto

  • Status changed from reopened to closed
  • Resolution set to fixed

The best soultion for this problem is to list the widget instance in the tg.include_widgets config options list. Resources form widgets listed there are included in every page that needs them (that is... every single page! ;).

in myapp/widgets.py

artist_search_form = w.ListForm(fields=SearchBox(), name="search",

in myapp/config/app.cfg

tg.include_widgets = ['myapp.widgets.artist_search_form']

finally, in master.kid

<div id="searchbox">

Sorry for the delay in closing this, Elvelind implemented this long time ago in [1576] I presume to fix precisely this issue.


Note: See TracTickets for help on using tickets.