*modules/test_field_constructor.py*
represent_reference_0 = lambda value, field: \
A('%s, %s, %s' % (field.address.street, field.address.city, 
field.address.country), 
  
_href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=%s,+%s,+%s";
 
  % (field.address.street, field.address.city, field.address.country) )

*using SQLFORM.grid() produce = *
<a 
href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;time=&amp;date=&amp;ttype=&amp;q=street,+city,+country";>street,
 
city, country</a>

*using datatables.net produce =*
Traceback (most recent call last):
  File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in 
restricted
    exec ccode in environment
  File 
"/Users/MacBookPro/site/web2py/applications/test/views/templates/grid/list.html",
 
line 90, in <module>
    </a>
  File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/objects.py", 
line 2695, in <genexpr>
    return (self.render(i, fields=fields) for i in range(len(self)))
  File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/objects.py", 
line 2712, in render
    row[table])
  File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py", 
line 1076, in represent
    return self.representers[name](*args, **kwargs)
  File "/Users/MacBookPro/site/web2py/gluon/sqlhtml.py", line 70, in 
represent
    return f(value, record)
  File "applications/test/modules/test_field_constructor.py", line 33, in 
<lambda>
    % (field.address.street, field.address.city, field.address.country) ) 
if value else ''
AttributeError: 'long' object has no attribute 'street'

already tried = 
*models/db.py*
db = DAL(..., lazy_tables = True) # setting lazy_tables = True or False 
still got the same result

any hints to face this?

another strange things is :
*models/db.py*
db.define_table('address', 
Field('street', 'text'), # when change the field name into address the 
result using datatables turn into None
Field('city'), 
Field('country'), 
format = lambda r: '%s, %s, %s, %s' % (r.street, r.city, r.country) )

e.g.
db.address.street.represent = lambda value, field: SPAN(value)
*result using datatables.net =* whatever value store in this field

db.address.address.represent = lambda value, field: SPAN(value)
*result using datatables.net =* None (no errors occured but the result is 
not expected)

while tested using SQLFORM.grid() both field name (address or street) run 
as expected

tested from scratch (new web2py app)

thanks and best regards,
stifan

-- 
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