I meant the web2py online book http://web2py.com/book or is this the
same somehow?.
On Tuesday, October 29, 2013 8:03:36 PM UTC-4, Niphlod wrote:
free and available here github.com/mdipierro/web2py-book
On Tuesday, October 29, 2013 10:13:28 PM UTC+1, DenesL wrote:
Is the book open
@Niphlod
the workaround is required because web2py creates
data-options={mode:calbox}
which ends up like this in the INPUT element source code in the generated
page
mode:calbox}= data-options={
All works fine if the output from web2py is enclosed in single quotes
instead, as in
I generated that simply with
data=dict(options='{mode : calbox}')
On Tuesday, October 29, 2013 11:52:55 AM UTC+1, DenesL wrote:
@Niphlod
the workaround is required because web2py creates
data-options={mode:calbox}
which ends up like this in the INPUT element source code in the generated
@Anthony
from module import *
def f():
header = ...
content = GRID(... ( # CALBOX used to create one of the columns
footer =
return {'page':PAGE(header, content, footer)}
I guess it's hard to say without knowing what those other functions do, but
I don't think web2py is
Anyway, it might not be a bad idea to allow the option to use single quotes
around an HTML attribute, though not sure of the best way to achieve that.
Maybe use a double underscore to identify such attributes:
INPUT(..., **{'__data-options': XML('{mode:calbox}')})
or add a json argument to
The other functions are pretty ordinary, there are just wrappers of the
standard helpers.
Most of them return DIV with some added attributes for jQuery Mobile.
On Tuesday, October 29, 2013 8:36:19 AM UTC-4, Anthony wrote:
@Anthony
from module import *
def f():
header = ...
content
True, thanks.
That generates HTML entities in the output which work fine as you pointed
out before:
data-options='{quot;modequot;:quot;calboxquot;}'
Probably it was that presentation that got me started on using XML to get
rid of them.
On that note two things spring to mind:
1) Add an entry
but why since data=dict(options='{mode : calbox}') works fine ?
Il giorno martedì 29 ottobre 2013 13:49:12 UTC+1, Anthony ha scritto:
Anyway, it might not be a bad idea to allow the option to use single
quotes around an HTML attribute, though not sure of the best way to achieve
that. Maybe
Yeah, I suppose it's not necessary as long as quot; within the string
never causes any problems.
Anthony
On Tuesday, October 29, 2013 11:47:10 AM UTC-4, Niphlod wrote:
but why since data=dict(options='{mode : calbox}') works fine ?
Il giorno martedì 29 ottobre 2013 13:49:12 UTC+1, Anthony
This dead horse could take one last beating, couldn't it?.
On Tuesday, October 29, 2013 11:47:10 AM UTC-4, Niphlod wrote:
but why since data=dict(options='{mode : calbox}') works fine ?
Il giorno martedì 29 ottobre 2013 13:49:12 UTC+1, Anthony ha scritto:
Anyway, it might not be a bad
seems that any major js framework accessing data-* do the escaping (as they
should) so it's really not a problem.
On Tuesday, October 29, 2013 5:01:22 PM UTC+1, Anthony wrote:
Yeah, I suppose it's not necessary as long as quot; within the string
never causes any problems.
Anthony
On
Is the book open to editors?.
I still would like to add an example about this in there.
--
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
free and available here github.com/mdipierro/web2py-book
On Tuesday, October 29, 2013 10:13:28 PM UTC+1, DenesL wrote:
Is the book open to editors?.
I still would like to add an example about this in there.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
-
Thanks Anthony, it sounds like a good idea but the browser ends up
receiving:
data-options={quot;modequot;:quot;calboxquot;,
quot;useNewStylequot;:true}
We need to make this easier (let alone work), the newer mobile add-ons/plug-ins
are using the data attributes a lot.
If anyone else wants
On Monday, October 28, 2013 10:46:30 AM UTC-4, DenesL wrote:
Thanks Anthony, it sounds like a good idea but the browser ends up
receiving:
data-options={quot;modequot;:quot;calboxquot;,
quot;useNewStylequot;:true}
When I try it, web2py returns the following to the browser:
input
Check the source of the returned page, is it still good?.
The code is:
def CALBOX(*args, **vars):
vars['_type']='text'
vars['_data-role']='datebox'
vars['data']={'options':XML('{mode:calbox, useNewStyle:true}')}
x = INPUT(*args, **vars)
return XML(x.xml().replace('{', '{).replace('}',
BTW, the quoted representation **should** be valid nonetheless.
What plugins do is extracting whatever is in the data and evaluating to a
js object, so it shouldn't really matter beween
data-something='{a: b}'
and
data-something=thequotedrepr_of_{a:b}
unless the plugin is so strict (and
Thanks Niphlod, that is true.
The problem was in one of the js files from dev.jtsage.com (or with the one
I had downloaded).
It works fine with the latest from their cdn
http://dev.jtsage.com/cdn/datebox/latest/
*Still, having to add Anthony's trick seems very un-web2py-ish*
@DenesL...uhm...what I was saying is that a plugin **should** expect
anything in a data-* to be escaped. This means that from a plugin
standpoint,
input data-options={quot;modequot;:quot;calboxquot;} type=text id=
test1 /
should be treated exactly as
input data-options='{mode:calbox}'
CALBOX(_name='tsdate', _id='tsdate')
Where exactly does the above line go? When I try you exact code, I do not
get any escaping of the quotes (checked the source returned to the browser
and even tried using gluon.tools.fetch from the shell).
Anthony
--
Resources:
- http://web2py.com
-
what are you expecting to see in the raw generated input ?
On Friday, October 25, 2013 11:57:48 PM UTC+2, 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:
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('}', }'))
22 matches
Mail list logo