[web2py] Re: IMG helper and _width

2010-11-10 Thread annet
@Bruno,

Thanks for providing me with a working solution.


@Denes,

Thanks for explaining me why I got this error.


Kind regards,

Annet.


On Nov 10, 3:20 pm, DenesL  wrote:
> Annet, allow me a little explanation on why you got SyntaxError:
> keyword can't be an expression.
> web2py does not know that you are using CSS inside HTML, the error
> happens because IMG is expecting named arguments, which are dictionary
> keys and those keys must be valid hashable ids.
>
> _src is a valid hashable id.
> _vertical-align is not, because python will try to interpret that as
> the following expression:
> _vertical (an id) minus (math operator) align (another id).
>
> Hope this helps.
>
> On Nov 10, 7:00 am, Martín Mulone  wrote:
>
> > Like bruno said, there are no attribute vertical-align in img object, this
> > is  css style thing
>
> > 2010/11/10 Bruno Rocha 
>
> > > This is working for me:
>
> > > {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> > > logo[0].link), _style="vertical-align:'middle';")}}
>
> > > 2010/11/10 annet 
>
> > > Massimo,
>
> > >> Thanks, problem solved. However, this:
>
> > >> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> > >> logo[0].link), _vertical-align="middle")}}
>
> > >> .. result in a SyntaxError: keyword can't be an expression
>
> > >> According to W3C I should be able to set vertical-align on an img.
>
> > >> Kind regards,
>
> > >> Annet.
>
> > > --
>
> > >http://rochacbruno.com.br
>
> > --
> > My blog:http://martin.tecnodoc.com.ar
> > My portfolio *spanish*:http://www.tecnodoc.com.ar
> > Checkout my last proyect instant-press:http://www.instant2press.com
>
>


[web2py] Re: IMG helper and _width

2010-11-10 Thread DenesL

Annet, allow me a little explanation on why you got SyntaxError:
keyword can't be an expression.
web2py does not know that you are using CSS inside HTML, the error
happens because IMG is expecting named arguments, which are dictionary
keys and those keys must be valid hashable ids.

_src is a valid hashable id.
_vertical-align is not, because python will try to interpret that as
the following expression:
_vertical (an id) minus (math operator) align (another id).

Hope this helps.

On Nov 10, 7:00 am, Martín Mulone  wrote:
> Like bruno said, there are no attribute vertical-align in img object, this
> is  css style thing
>
> 2010/11/10 Bruno Rocha 
>
>
>
> > This is working for me:
>
> > {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> > logo[0].link), _style="vertical-align:'middle';")}}
>
> > 2010/11/10 annet 
>
> > Massimo,
>
> >> Thanks, problem solved. However, this:
>
> >> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> >> logo[0].link), _vertical-align="middle")}}
>
> >> .. result in a SyntaxError: keyword can't be an expression
>
> >> According to W3C I should be able to set vertical-align on an img.
>
> >> Kind regards,
>
> >> Annet.
>
> > --
>
> >http://rochacbruno.com.br
>
> --
> My blog:http://martin.tecnodoc.com.ar
> My portfolio *spanish*:http://www.tecnodoc.com.ar
> Checkout my last proyect instant-press:http://www.instant2press.com


Re: [web2py] Re: IMG helper and _width

2010-11-10 Thread Martín Mulone
Like bruno said, there are no attribute vertical-align in img object, this
is  css style thing

2010/11/10 Bruno Rocha 

> This is working for me:
>
> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> logo[0].link), _style="vertical-align:'middle';")}}
>
> 2010/11/10 annet 
>
> Massimo,
>>
>> Thanks, problem solved. However, this:
>>
>> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
>> logo[0].link), _vertical-align="middle")}}
>>
>> .. result in a SyntaxError: keyword can't be an expression
>>
>> According to W3C I should be able to set vertical-align on an img.
>>
>>
>> Kind regards,
>>
>> Annet.
>
>
>
>
> --
>
> http://rochacbruno.com.br
>



-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


Re: [web2py] Re: IMG helper and _width

2010-11-10 Thread Bruno Rocha
This is working for me:

{{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
logo[0].link), _style="vertical-align:'middle';")}}

2010/11/10 annet 

> Massimo,
>
> Thanks, problem solved. However, this:
>
> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
> logo[0].link), _vertical-align="middle")}}
>
> .. result in a SyntaxError: keyword can't be an expression
>
> According to W3C I should be able to set vertical-align on an img.
>
>
> Kind regards,
>
> Annet.




-- 

http://rochacbruno.com.br


[web2py] Re: IMG helper and _width

2010-11-10 Thread annet
Massimo,

Thanks, problem solved. However, this:

{{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/%s' %
logo[0].link), _vertical-align="middle")}}

.. result in a SyntaxError: keyword can't be an expression

According to W3C I should be able to set vertical-align on an img.


Kind regards,

Annet.


[web2py] Re: IMG helper and _width

2010-11-09 Thread mdipierro
{{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/' +
logo[0].link) _width="228px")}}

should be

{{=IMG(_src=URL('static','base/card/logos/%s' % slogo[0].link),
_width="228px")}}

, was missing
On Nov 9, 1:07 pm, annet  wrote:
> I get an error on the following code:
>
> {{=IMG(_src=URL(r=request,a='base',c='static',f='base/card/logos/' +
> logo[0].link) _width="228px")}}
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> restricted.py", line 186, in restricted
>     ccode = compile2(code,layer)
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> restricted.py", line 173, in compile2
>     return compile(code.rstrip().replace('\r\n','\n')+'\n', layer,
> 'exec')
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
> init/views/locator/businesscard.html", line 45
>     response.write(IMG(_src=URL(r=request,a='base',c='static',f='base/
> card/logos/' + logo[0].link) _width="228px"))
>
> SyntaxError: invalid syntax
>
> The ^ sign is under the h of _width="228px"
>
> Does one of you know the correct syntax?
>
> Kind regards,
>
> Annet.