How do I resolve this error? 

Traceback (most recent call last):
  File "/Users/web2py/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "<string>", line 83, in <module>
  File "/Users/web2py/web2py/gluon/globals.py", line 422, in write
    self.body.write(to_native(xmlescape(data)))
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
    return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
    (fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
    co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
    return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
    (fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
    co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
    return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
    (fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
    co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
    return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
    (fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
    co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
    return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/html.py", line 960, in xml
    (fa, co) = self._xml()
  File "/Users/web2py/web2py/gluon/html.py", line 952, in _xml
    co = b''.join([xmlescape(component) for component in self.components])
  File "/Users/web2py/web2py/gluon/html.py", line 125, in xmlescape
    return to_bytes(data.xml())
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 
2497, in xml
    rv = self.db.represent('rows_xml', self)
  File "/Users/web2py/web2py/gluon/packages/dal/pydal/base.py", line 834, 
in represent
    return self.representers[name](*args, **kwargs)
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3322, in __init__
    tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
  File "/Users/web2py/web2py/gluon/sqlhtml.py", line 3322, in <genexpr>
    tablemap = dict(((f.tablename, f.table) for f in fieldmap.values()))
AttributeError: 'Expression' object has no attribute 'tablename'

The code that throws this error:

def dbselect():
    only_after = 
    t = db[ 'unique_sites' ]
    h = db[ 'TABLE_of_sites' ]
    max = h.last_updated.max()
    q = h.type_id==1
    q&= h.last_updated>datetime.now()-timedelta(weeks=8)
    join = t.on(t.url==h.url)
    rows = db(q).select(t.ALL, max, groupby=t.ALL, join=join) # this 
produces the error above :(
    rows = db(q).select(t.ALL, max, groupby=t.ALL, join=join).as_list() 
#this doesn't throw the error :)
    return locals()


VERSION:

*Version 2.15.2-stable+timestamp.2017.07.19.01.21.31*

*Postgresql 9.6 + psycopg2 adapter*



Thank you!





-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to