I do not think this needs to be in web2py.

You can already define something like:

def url(f,args=request.args): return URL(r=request,f=f,args=args)

I always do it together with some of my other favorite shortcuts.

Massimo

On Jul 6, 8:06 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Jul 6, 2009, at 2:10 PM, mdipierro wrote:
>
>
>
> > _action=URL(r=request))
>
> > is probably fine
>
> > _action=URL(r=request,args=request.args))
>
> > to be user
>
> Because valid html requires a non-empty action, I'd like to make the  
> effort to specify self-submission as easy as possible. I've been  
> thinking along these lines:
>
>         FORM(..., _action=request._self)
>
> where:
>
> class Request(Storage):
>
>      ...
>
>      def _self(self):
>          return URL(r=self, args=self.args)
>
> or two methods, if there's a reason you don't want the args. Depending  
> on which is more commons, _self() and _self_args() or _self() and  
> _self_only, say.
>
> Or even simpler:
>
>         FORM(..., r=request)
>
> where FORM would fill in action with a self-reference if it's not  
> otherwise specified (instead of setting it to '' as it does now). (And  
> depending on whether we need with-args and without-args flavors.)
>
> Again, the general idea is that a) valid html is highly desirable, b)  
> self-submission is a very common case, and consequently c) it's  
> worthwhile making that case as concise as possible.
>
>
>
> > On Jul 6, 3:32 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> >> On Jul 6, 2009, at 12:31 PM, Yarko Tymciurak wrote:
>
> >>> _action value (in SQLForm) is what "action" in HTML FORM  will be
> >>> set to.
>
> >>> It is a URI, so "." is relative to the current context.
>
> >>> check out something likehttp://www.w3.org/TR/html401/interact/forms.html
> >>>  for more.
>
> >> OK, thanks.
>
> >> The problem with that, as I read the RFC, is that the "current
> >> context" means the current URL with everything to the right of the
> >> rightmost slash deleted, which isn't going to work very well for
> >> web2py URLs, if the intent is a self-reference (unless perhaps the
> >> current URL is to the default controller and/or function).
>
> >> Here's why I'm asking: a missing or empty form action is invalid
> >> (x)html, and I'm looking for the most concise way of asking for a  
> >> self-
> >> reference. action="." would work fine if the URL ended in a slash,  
> >> but
> >> it does not.
>
> >> The shortest self-reference I can see is: FORM( ...,
> >> _action=URL(r=request))
>
> >> Is that right?
>
> >>> On Mon, Jul 6, 2009 at 1:44 PM, Jonathan Lundell
> >>> <jlund...@pobox.com> wrote:
>
> >>> The example _action='.' appears in the manual, section 7.2  
> >>> (SQLForm),
> >>> page 168.
>
> >>> What does that mean?
--~--~---------~--~----~------------~-------~--~----~
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