Ticket #2413 (closed defect: fixed)
Installing tw.dojo breaks CrudRestController from tgext.crud
| Reported by: | boulon | Owned by: | percious |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1b2 |
| Component: | TurboGears | Version: | 2.1a1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
This bug actually have been seen on tgext.crud (tgext.crud-0.3.3-py2.5.egg) using TurboGears 2.1a2, not 2.1a1 (but the later isn't in the Version list):
At the top of tgext.crud.controller you can find these lines:
try: import tw.dojo except ImportError: use_paginate = True from tg.decorators import paginate else: # if dojo ist installed, we don't need pagination use_paginate = False
However later in the file, in the get_all method of CrudRestController? you can find the following lines:
if use_paginate: values = self.table_filler.get_value(**kw) else: values = [] tmpl_context.paginators = None tmpl_context.widget = self.table return dict(model=self.model.__name__, value_list=values)
Which means that if you install tw.dojo then the get_value method isn't called anymore, leading to a 'No Records found' message.
One possible workaround may be to not only install tw.dojo, but use it (with DojoTable? and DojoTableFiller?) :) However my attempt to do that failed in another way that I will probably file here too after more investigation.
I investigated this problem and found it to be user error, however, There is a problem with having tw.dojo installed and getting pagination to work. It is possible that we need to modify sprox to have something like a "get's own data" flag or something so that the page controller knows whether to populate the table with data. Therefore, this ticket is being left open.