On May 12, 10:16 pm, Russell <russell.mcmur...@gmail.com> wrote:
> Hi,
>
> I've recently experienced two issues with the html helpers when trying
> to implement <colgroup>.
>
> First, the TAG helper doesn't seem to pickle (but all the others do).
> Have I missed something here?
>
> >>> import cPickle
> >>> htm1 = cPickle.dumps(DIV())
> >>> htm2 = cPickle.dumps(TAG.colgroup())
>
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
> PicklingError: Can't pickle <class 'gluon.html.__tag__'>: attribute
> lookup gluon
> .html.__tag__ failed

Sorry TAG.whatever is not serializable with pickle. You can only
serialize it after converting to string with srt().

> Second, the TABLE helper doesn't seem to treat colgroup
> appropriately...
>
> >>> table = TABLE(TAG.colgroup(),THEAD(),TBODY())
> >>> print table
>
> <table><tr><td><colgroup></colgroup></td></tr><thead></thead><tbody></
> tbody></ta
> ble>
>
> When something like this would seem the preferable result...
>
> <table><colgroup></colgroup><thead></thead><tbody><tr><td></td></tr></tbody></table>

TABLE is too smart but does not know about colgroup. You can do

table = TAG.table(TAG.colgroup(),THEAD(),TBODY())

 > I know the work-around is to split it into two steps with
"table.insert (0,TAG.colgroup())", but that does seem a little messy
(and then it  doesn't pickle anyway).  Perhaps a colgroup helper is
warranted?

You can do it yourself. redefine
TABLE=TAG.table
COLGROUP=TAG.colgroup

serialize it with table.xml().

Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to