Also, there is a way to represent two types, text and html?

For example, if i want to make a tooltip of a date fiel, to make things 
clean and easy for the user, I would do:

<https://lh5.googleusercontent.com/-SPmSRMlcTjU/VOP4g-v2c6I/AAAAAAAAAfg/WnJ4hsfiaek/s1600/exemplo.png>

That is a the return of the represent field:

dt_str = valor.strftime("%d/%m/%Y")
return SPAN(dt_str, **{'_data-toggle': "tooltip",
                       '_data-placement': "top",
                       '_title': valor.strftime("%A").title()})

But if i try to export that. I'll get the html on the export file.

There is a way to separate the HTML of the text that will be represented in 
export? Like a represent_html and represent_text?

Em terça-feira, 17 de fevereiro de 2015 16:02:20 UTC-2, Massimo Di Pierro 
escreveu:
>
> I just fixed this in trunk and I will rebuilding the new nightly built, 
> try in 1h.
>
> On Monday, 16 February 2015 21:08:31 UTC-6, Leonardo Pires Felix wrote:
>>
>> Hi, when i return a XML from the represent, it gives me a error.
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>>   File "/home/leonardo/PycharmProjects/lpfx_gie/web2py/gluon/restricted.py", 
>> line 224, in restricted
>>     exec ccode in environment
>>   File 
>> "/home/leonardo/PycharmProjects/lpfx_gie/web2py/applications/gie/controllers/secretaria.py"
>>  <http://127.0.0.1:8000/admin/edit/gie/controllers/secretaria.py>, line 771, 
>> in <module>
>>   File "/home/leonardo/PycharmProjects/lpfx_gie/web2py/gluon/globals.py", 
>> line 393, in <lambda>
>>     self._caller = lambda f: f()
>>   File "/home/leonardo/PycharmProjects/lpfx_gie/web2py/gluon/tools.py", line 
>> 3444, in f
>>     return action(*a, **b)
>>   File 
>> "/home/leonardo/PycharmProjects/lpfx_gie/web2py/applications/gie/controllers/secretaria.py"
>>  <http://127.0.0.1:8000/admin/edit/gie/controllers/secretaria.py>, line 416, 
>> in entradas
>>     exportclasses=classeExportar, 
>> orderby=~db.entrada_cartao_alunos.horario_entrada)
>>   File "/home/leonardo/PycharmProjects/lpfx_gie/web2py/gluon/sqlhtml.py", 
>> line 2661, in grid
>>     value = field.formatter(value)
>>   File 
>> "/home/leonardo/PycharmProjects/lpfx_gie/web2py/gluon/dal/objects.py", line 
>> 1636, in formatter
>>     value = item.formatter(value)
>>   File "/home/leonardo/PycharmProjects/lpfx_gie/web2py/gluon/validators.py", 
>> line 2373, in formatter
>>     year = value.year
>> AttributeError: 'XML' object has no attribute 'year'
>>
>>
>> But when i remove the XML, it gives me no error. So, The represent of the 
>> field has limitation?
>> I'm tryng to return a attr html type.
>> That's the content of the represent method
>> dt_str = valor.strftime("%H:%M:%S %d/%m/%Y")
>> return XML('<abbr title="%s">%s</abbr>' % (valor.strftime("%A").title(), 
>> dt_str))
>>
>>
>>

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