kid-genshi, strange grid issue

8 views
Skip to first unread message

Glauco Uri

unread,
Oct 9, 2009, 5:22:22 AM10/9/09
to turbo...@googlegroups.com
Hi all,
in these days i migrate some web application into unique infrastructure
and i'm finding some undocumented issue in datagrid.

first, i want to introduce genshi (using tg widgets) ,
and finally my idea is to migrate entirely to genshi with TW.

kid version was entirely in kid templating and i'v lot of datagrid
presonalized like this:

def lnk( x):
a=wid.URLLink( text=x.cNote, link=tg.url(<url>) )
return a.display()


gridFields=[
...
DataGrid.Column(name='foo', title='bar', getter=lambda
x: lnk(x) ),
...
]


Ive noticed thad using tg widgets for inject html into datagrid give
always:


File
".../TurboGears-1.1b3-py2.5.egg/turbogears/widgets/templates/datagrid.py",
line 74, in _pull
File ".../site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 180,
in _track
ev, item = p
ValueError: too many values to unpack

some ideas?
thank you

--
Glauco Uri

Prometeia SpA
Via G. Marconi, 43
40122 Bologna
Italy

e-mail : glauc...@prometeia.it
phone : +39 051 6480911

---------------------------------------------------------------------------
Il contenuto e gli allegati di questo messaggio sono strettamente confidenziali, e ne sono vietati la diffusione, la riproduzione e l'uso non autorizzato. Il suo contenuto non costituisce impegno da parte della Società salvo accordo scritto tra quest'ultima ed il destinatario. Qualora il presente messaggio Le fosse pervenuto per errore, La preghiamo di comunicare immediatamente al mittente l'errata ricezione e di distruggere quanto ricevuto (compresi i file allegati) senza farne copia.
Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo di non rivelare il contenuto della corrispondenza tra altri soggetti, salvo più grave illecito, ed espone il responsabile alle relative conseguenze.

This e-mail (and any attachment(s)) is strictly confidential and for use only by intended recipient(s). Any use, distribution, reproduction or disclosure by any other person is strictly prohibited. The content of this e-mail does not constitute a commitment by the Company except where provided for in a written agreement between this e-mail addressee and the Company. If you are not an intended recipient(s), please notify the sender promptly and destroy this message and its attachments without reading or saving it in any manner.
Any non authorized use of the content of this message constitutes a violation of the obligation to abstain from learning of the correspondence among other subjects, except for more serious offence, and exposes the person responsible to the relevant consequences.
---------------------------------------------------------------------------

Christoph Zwerschke

unread,
Oct 9, 2009, 6:55:53 AM10/9/09
to turbo...@googlegroups.com
Glauco Uri schrieb:

> first, i want to introduce genshi (using tg widgets) ,
> and finally my idea is to migrate entirely to genshi with TW.

TG widgets currently do not support Genshi templates (not yet - I'm
considering to add this feature to TG 1.1/1.2/1.5 to make the Genshi
support more consistent).

> def lnk( x):
> a=wid.URLLink( text=x.cNote, link=tg.url(<url>) )
> return a.display()
>
>
> gridFields=[
> ...
> DataGrid.Column(name='foo', title='bar', getter=lambda
> x: lnk(x) ),
> ...]
>
> Ive noticed thad using tg widgets for inject html into datagrid give

> always: ... ValueError: too many values to unpack

What exactly do you mean with "inject html into datagrid"? The above
works for me in TG 1.1. Btw, you can write it in a more compact way:

def lnk(x):
return wid.URLLink(text=x.cNote, link=tg.url(<url>))()

gridFields=[
...
DataGrid.Column('foo', lnk, 'bar'),
...]

-- Christoph

Glauco

unread,
Oct 9, 2009, 8:22:34 AM10/9/09
to turbo...@googlegroups.com
Christoph Zwerschke ha scritto:
Glauco Uri schrieb:
  
first, i want to introduce genshi (using tg widgets) ,
and finally my idea is to migrate entirely to genshi with TW.
    
TG widgets currently do not support Genshi templates (not yet - I'm 
considering to add this feature to TG 1.1/1.2/1.5 to make the Genshi 
support more consistent).
  
I know this, TG widgets currently do not support Genshi templates but  genshi template support tg widgets.

i will see for news ,and thank you for this exceptional work


  
def lnk( x):
    a=wid.URLLink( text=x.cNote, link=tg.url(<url>) )
    return a.display()


gridFields=[
           ...
           DataGrid.Column(name='foo',     title='bar',    getter=lambda 
x: lnk(x) ),
           ...]

Ive noticed thad using  tg widgets for inject html into datagrid  give 
always:  ... ValueError: too many values to unpack
    
What exactly do you mean with "inject html into datagrid"? The above 
works for me in TG 1.1. Btw, you can write it in a more compact way:

def lnk(x):
      return wid.URLLink(text=x.cNote, link=tg.url(<url>))()

gridFields=[
             ...
             DataGrid.Column('foo', lnk, 'bar'),
             ...]


  
This is exactly what i do now,
in fact if  i use a page kid template with this code all work perfectly, but switching page template  to genshi in all pages raise the problem.


thank's
Glauco

Christoph Zwerschke

unread,
Oct 9, 2009, 8:55:56 AM10/9/09
to turbo...@googlegroups.com
Glauco schrieb:

> This is exactly what i do now,
> in fact if i use a page kid template with this code all work perfectly,
> but switching page template to genshi in all pages raise the problem.

Ok. I was unsure because the error you got was from Kid, but I expected
a Genshi error in this case.

I'll see if I can reproduce this later today.

-- Christoph

Christoph Zwerschke

unread,
Oct 10, 2009, 12:34:16 PM10/10/09
to turbo...@googlegroups.com
Christoph Zwerschke schrieb:

> I'll see if I can reproduce this later today.

Checked this today and was not able to reproduce it in a setting similar
to yours (datagrid displaying simple widgets as data). Note that you
must write ET(grid(...)) in the page template when using Genshi.

But I was able to reproduce a similar error with a grid that displayed
another TG widget in its custom template.

Maybe you do something similar in your URLLink widget?

I'll explore this further and create a bugfix ticket if needed.

-- Christoph

Christoph Zwerschke

unread,
Oct 10, 2009, 6:00:48 PM10/10/09
to turbo...@googlegroups.com
Christoph Zwerschke schrieb:

> I'll explore this further and create a bugfix ticket if needed.

http://trac.turbogears.org/ticket/2390

Glauco, can you check whether my patch solves your issue?

-- Christoph

Glauco

unread,
Oct 12, 2009, 5:12:51 AM10/12/09
to turbo...@googlegroups.com
Christoph Zwerschke ha scritto:
Christoph,  what an incredible effectiveness!!!
this work perfectly for me.



thank you again
Glauco


Reply all
Reply to author
Forward
0 new messages