Re: [web2py] Re: Changing links on SQLTABLE

2010-12-09 Thread Bruno Rocha
I just got it! the problem is in definition of headers, when headers=None this works well. I am going to patch for this. 2010/12/9 Bruno Rocha > Note that when I do: > > print sqlrows.colnames in sqlhtml.py I get: > > ['task.id', 'task.title', 'task.story', 'task.type', 'task.body', > 'task.pri

Re: [web2py] Re: Changing links on SQLTABLE

2010-12-09 Thread Bruno Rocha
Note that when I do: print sqlrows.colnames in sqlhtml.py I get: ['task.id', 'task.title', 'task.story', 'task.type', 'task.body', 'task.priority', 'task.assigned_to', 'task.estimated_hours', 'task.spent_hours', 'task.status', 'task.created_on', 'task.created_by', 'task.updated_on', 'task.updated

Re: [web2py] Re: Changing links on SQLTABLE

2010-12-09 Thread Bruno Rocha
This: class ExtraField: def new_column(self): if self.task.id==1: return A('some_action_link', _href=URL(f='default', args=[self.task.id])) else: return A('great thing', _href='http://www.web2py.com')

Re: [web2py] Re: Changing links on SQLTABLE

2010-12-09 Thread Ivan Matveev
You can put anything in SQLTABLE by modifying Rows object with rows.setvirtualfields. See this post http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689

Re: [web2py] Re: Changing links on SQLTABLE

2010-12-09 Thread Bruno Rocha
I think I do not understant your options very well, but now I am working on the way I mentioned. My SQLTABLE receives a parameter called rd (represent dictionary) and I can pass any string with placeholders and fields to fetch the value. I dont want to change the 'represent' at the model level,

[web2py] Re: Changing links on SQLTABLE

2010-12-08 Thread mdipierro
Other options: 1) db.table.field.represent=lambda row='row': ... if field.represent.func_defaults[0]=='row': ... 2) db.table.field.represent=lambda row={}: ... if isinstance(field.represent.func_defaults[0],dict): ... 3) if field.represent.func_code.co_varnames[0]=='row': ... this is

Re: [web2py] Re: Changing links on SQLTABLE

2010-12-08 Thread Bruno Rocha
I am overriding SQLTABLE class, here is my idea, let me know if this is a stupid idea :P I want to pass to SQLTABLE a represent_dictionary which I call 'rd', so if I have a table: db.define_table('person', Field('name'), Field('city'),

[web2py] Re: Changing links on SQLTABLE

2010-12-08 Thread mdipierro
Sorry. Cannot be done this way. Represent takes the field value, not the entire row. The reason is that when web2py tries to represent a field in a SQLTABLE or in a FORM, only that field is guaranteed to be there. the other fields may not have been fetched from the database. Anyway... I will think

[web2py] Re: Changing links on SQLTABLE

2010-12-08 Thread Bruno Rocha
I Know this is an VERY OLD post, but I was searching the group and I now have the same need as weheh in this thread. db.define_table('person', Field('name'), Field('city'), Field('state'), Field('email',represent: lambda row: A(_href=URL('changemail',vars=dict(person_id=row.id ) But, lambda