Web2py Version 2.15.2-stable+timestamp.2017.07.19.12.18.41

I found a clearer explanation than I could get in the Book on how to
pass exportclasses to a grid:

http://rootpy.com/Export-in-SQLFORM-grid/

and it worked as far as the buttons are concerned.

But then the export does not work.

Here is code that can reproduce it:

With this code, all the forms of export works except tsv and
tsv_with_hidden_cols:
Model:

db.define_table("xx",
                Field("x1"),
                Field("x2"))

Controller:

def index():
      grid = SQLFORM.grid(db.xx,csv = True)
    return dict(grid = grid)

Error for tsv-export:
Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 64, in <module>
  File "/home/js/web2py/gluon/globals.py", line 409, in <lambda>
    self._caller = lambda f: f()
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 13, in index
    grid = SQLFORM.grid(db.xx,csv = True)
  File "/home/js/web2py/gluon/sqlhtml.py", line 2594, in grid
    raise HTTP(200, oExp.export(), **response.headers)
  File "/home/js/web2py/gluon/sqlhtml.py", line 3615, in export
    records = self.represented()
  File "/home/js/web2py/gluon/sqlhtml.py", line 3566, in represented
    field = self.rows.db[t][f]
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 663,
in __getitem__
    return self.__getattr__(str(key))
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 670,
in __getattr__
    return BasicStorage.__getattribute__(self, key)
AttributeError: 'DAL' object has no attribute '"xx"'

And with the following code nothing the csv, tsv and html buttens shows
and when clicked nothing works:

def index():
    export_classes = dict(csv=True, json=False, html=True,
                          tsv=True, xml=False, csv_with_hidden_cols=False,
                          tsv_with_hidden_cols=False)
    grid = SQLFORM.grid(db.xx,  exportclasses = export_classes)
    return dict(grid = grid)

Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 64, in <module>
  File "/home/js/web2py/gluon/globals.py", line 409, in <lambda>
    self._caller = lambda f: f()
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 22, in index
    exportclasses = export_classes)
  File "/home/js/web2py/gluon/sqlhtml.py", line 2587, in grid
    oExp = clazz(rows)
TypeError: 'bool' object is not callable

Why the error?
A bug?

Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to