Can't check for image sizes unless I know where the static dir (and
thus image files) of the given app are.

On Dec 2, 3:35 am, mdipierro <[EMAIL PROTECTED]> wrote:
> Why do you need the request.folder? It is not visible from there.
>
> On Dec 1, 7:45 pm, achipa <[EMAIL PROTECTED]> wrote:
>
> > I guess I could, but have a few dilemmas... How do I find out
> > elegantly the request.folder from within the helper ? I'd hate to have
> > the request object or a separate attribute passed down to the helper
> > just for that.
>
> > On Dec 1, 5:30 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > Yes, we can do that. Can you send me a patch?
>
> > > Massimo
>
> > > On Dec 1, 10:27 am, achipa <[EMAIL PROTECTED]> wrote:
>
> > > > Well, the ugly solution for that would be a default 'literal=True'
> > > > parameter in the constructor. It still feels wrong for the user to do
> > > > the urlencode, as then it's already inconsistent with URL() and many
> > > > other places where web2py does this automatically.
>
> > > > What about the other tags ? For example in my PHP days when I was
> > > > using Smarty (I know, I know, I was young and reckless) I liked how
> > > > for example Smarty handled the IMG tags. If you did {html_image
> > > > file='pumpkin.jpg'} you would get <img src="pumpkin.jpg" alt=""
> > > > width="44" height="68" />. Some key features: a) autoinserts ALT tag
> > > > even if not specified - great for validation, b) if the src given is
> > > > on a local path and image dimensions are not specified, it finds and
> > > > displays them (and caches the values for the next run).
>
> > > > On Nov 30, 2:58 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > on a second thought. This would break backward compatibility because
> > > > > quoting twice it no longer the equivalent to the original URL.
>
> > > > > Massimo
>
> > > > > On Nov 29, 7:13 pm, achipa <[EMAIL PROTECTED]> wrote:
>
> > > > > > 1) not sure abot GAE, but you can always make a poor man's
> > > > > > urllib.quote with some ord() magic.
>
> > > > > > 2) IIRC per RFC the encoded characters are equivalent with their 
> > > > > > non-
> > > > > > encoded counterparts (as long as they contain legal URI characters),
> > > > > > so some#thing is equal to some%27thing (and both IE and FFox will
> > > > > > display it non-encoded). But, again, if one is adamant about keeping
> > > > > > the non-encoded form, it's just one extra line with self.attributes
> > > > > > ['_src'].partition('#').
>
> > > > > > On Nov 30, 1:48 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > > > actually reading your email again I guess you are saying that for 
> > > > > > > _src
> > > > > > > and _href we should use urllib.quote instead of cgi.escape.
> > > > > > > something like
>
> > > > > > >      if self.attributes.has_key('_src'): self.attributes['_src']
> > > > > > > =urllib.quote(self.attributes['_src'])
>
> > > > > > > problems:
> > > > > > > 1) GAE does not have urllib. Is there an alternative?
> > > > > > > 2) urllib.quote encodes '#'  too. Is that correct?
>
> > > > > > > Massimo
>
> > > > > > > On Nov 29, 6:37 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > anctually helpers already automatically cgi.escape all tag 
> > > > > > > > attributes.
>
> > > > > > > > Massimo
>
> > > > > > > > On Nov 29, 5:15 pm, achipa <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > Inspired by the URL talk in the other thread, I'm wordering 
> > > > > > > > > if would
> > > > > > > > > make sense to make helpers a bit smarter to make conversions 
> > > > > > > > > and some
> > > > > > > > > defaults easier (not to mention standards compliance 
> > > > > > > > > enforcing !). The
> > > > > > > > > URL() helper is actually already moving in this direction as 
> > > > > > > > > it
> > > > > > > > > transparently urlencodes the parameters. So, I was thinking 
> > > > > > > > > we could
> > > > > > > > > do the same for helpers which deal with URL-s, f.e. A(), 
> > > > > > > > > IMG(), etc.
> > > > > > > > > For the A() tag, the 'smartness'  is required for example to 
> > > > > > > > > have the
> > > > > > > > > HREF field automatically urlescaped, or definining an empy 
> > > > > > > > > "#" HREF if
> > > > > > > > > it's not specified to pass validation. An image element 
> > > > > > > > > without an ALT
> > > > > > > > > and SRC tag will also not pass validation, thus, if these are 
> > > > > > > > > not
> > > > > > > > > provided, the helper should generate them on a best effort 
> > > > > > > > > basis. I
> > > > > > > > > would more likely expect from an IMG('something.jpg') to use 
> > > > > > > > > the
> > > > > > > > > string for src or alt and not throw an error. There are 
> > > > > > > > > probably more
> > > > > > > > > helpers that could do some more interpretation/validation 
> > > > > > > > > according to
> > > > > > > > > HTML specs. Thoughts ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to