Attributes are always put in double quotes: https://github.com/web2py/web2py/blob/master/gluon/html.py#L907. I suppose you could manually replace the double quotes after serializing:
input = INPUT(..., data={'options': XML('{"mode":"calbox"}')}) XML(input.xml().replace('"{', "'{").replace('}"', "}'")) Anthony On Friday, October 25, 2013 5:57:48 PM UTC-4, DenesL wrote: > > > using web2py 2.5.1 source on windows > > Having trouble creating an INPUT with a "non-trivial" data attribute. > Did try the following: > > INPUT(...,**{'_data-options':XML('{"mode":"calbox"}')} ) > > INPUT(..., data={'options':XML('{"mode":"calbox"}')} ) > > and several combinations with raw strings but it always outputs: > > <input data-options="{"mode":"calbox"}" ... /> which breaks on "{" > > Single quoted string works fine > data-options="{'mode':'calbox'}" > but the code requires double quoted strings. > > Bug, or is there a way I am not seeing?. > > Thanks, > Denes > > P.S. printing what goes on in DIV._xml() produces a lot of output for the > same attributes, inner component redundancy?. > -- 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/groups/opt_out.