Or '_next':URL(r=request,args=request.args[0],anchor='anchor')
On Jul 17, 10:30 pm, Alex Fanjul <alex.fan...@gmail.com> wrote: > Ok, I got it like this: > '_next':"%s#anchor"%URL(r=request,args=request.args[0]) > > Thanks > > El 18/07/2009 5:26, Alex Fanjul escribió: > > > Massimo, I think I'm getting some error like the David's one > > > I can't construct a dinamic url with an anchor with this sentence: > > "URL(r=request,args="%s#anchor"%request.args[0])" > > > because web2py transform to: > > "...default/proyecto/1%23anchor" > > > and it says "Invalid Request" > > > Any shortcut? or a way to encode/decode de "#" char? > > > Thanks, > > Alex F > > > El 16/07/2009 18:14, Jonathan Lundell escribió: > >> On Jul 16, 2009, at 7:57 AM, mdipierro wrote: > > >>> PS. > > >>> You can do still handle any type of special char in the url by using > >>> routes and mapping some args into a vars. > > >> I suppose that solves the immediate problem, but along with the > >> entirely legitimate role of web2py in machine-to-machine > >> communications, where human readability is irrelevant, there's no real > >> enforcement of readability anyway. Which of these is more human- > >> readable, anyway? > > >>http://localhost:8000/init/default/json_read_nologin/user%40domain.com > >>http://localhost:8000/init/default/json_read_nologin?email=user%40dom... > >>http://localhost:8000/init/default/json_read_nologin/dXNlckBkb21haW4u... > > >> web2py objects to the first, but not the second (vars) or third > >> (base64), both of which include 'encoded characters'. > > >>> On Jul 16, 9:54 am, mdipierro<mdipie...@cs.depaul.edu> wrote: > > >>>> This is a big can of worms. > > >>>> @ is a reserved character and if used in urls, it should be > >>>> encoded. I > >>>> do not want encoded chars in the URL because this defies the all > >>>> purpose: readability by humans. > > >>>> Massimo > > >>>> On Jul 16, 9:07 am, Jonathan Lundell<jlund...@pobox.com> wrote: > > >>>>> On Jul 16, 2009, at 6:35 AM, Jonathan Lundell wrote: > > >>>>>> On Jul 16, 2009, at 6:18 AM, mdipierro wrote: > > >>>>>>> web2py validates the URL and does allow the @ sign in the URL, > >>>>>>> only > >>>>>>> alphanumaric characters, _, - and non-consecutive . and /. > > >>>>>> Did you mean "does not allow"? Shouldn't the validation be more > >>>>>> generous in the args section? There's nothing wrong with this as an > >>>>>> http URL: > > >>>>>>http://localhost:8000/init/default/json_read_nologin/user%40domain.com > > >>>>>> (Where does the validation happen?) > > >>>>> OK, that last was a dumb question, since I just finished > >>>>> reformatting > >>>>> regex_url. > > >>>>> So here's the validation for args: ([\w\-][\=\./]?)+ > > >>>>> I don't want to make a proposal here, since I have no idea what args > >>>>> consumers are assuming for validation. But it does seem reasonable > >>>>> in > >>>>> the abstract to allow a little more than this pattern permits. > > >>>>> (And I could see piggybacking on the IS_HTTP_URL validator for the > >>>>> first cut.) > > >>>>>>> On Jul 16, 2:07 am, David Watson<davidthewat...@gmail.com> wrote: > > >>>>>>>> I'm using web2py 1.65.5 with google app engine. > > >>>>>>>> I've run into a problem with request.args in relation to my json > >>>>>>>> calls: > > >>>>>>>> @service.json > >>>>>>>> def json_read_nologin(): > >>>>>>>> return request.args[0] > > >>>>>>>> or the same function defined sans the service decorator, both > >>>>>>>> work > >>>>>>>> fine, as long as I don't pass something containing an @ sign, > >>>>>>>> i.e. > > >>>>>>>> http://localhost:8000/init/default/json_read_nologin/u...@domain.com > > >>>>>>>> this generates an invalid request even if url encoded: > > >>>>>>>>http://localhost:8000/init/default/json_read_nologin/user > >>>>>>>> %40domain.com > > >>>>>>>> I'm not sure what I'm doing wrong here but this behavior doesn't > >>>>>>>> seem > >>>>>>>> like what I'd expect. > > >>>>>>>> Thanks, > >>>>>>>> David > > >>>>>>>> On Jun 23, 8:47 pm, mdipierro<mdipie...@cs.depaul.edu> wrote: > > >>>>>>>>> You cannot mix authorization and services this way. It is > >>>>>>>>> complicated > >>>>>>>>> an there are many cases.... > > >>>>>>>>> If you have > > >>>>>>>>> @auth.requires_login() > >>>>>>>>> def acceptme(): > >>>>>>>>> return 'accepted' > > >>>>>>>>> you can call"http://..../acceptme.json" and you will get aJSON > >>>>>>>>> response. You do not need the decorator. > > >>>>>>>>> @auth.requires_login() > >>>>>>>>> @service.json() > >>>>>>>>> def acceptme(): > >>>>>>>>> return 'accepted' > >>>>>>>>> def run(): return service() > > >>>>>>>>> exposes"http://..../service/json/acceptme" before requiring > >>>>>>>>> login. > > >>>>>>>>> @service.json() > >>>>>>>>> def acceptme(): > >>>>>>>>> return 'accepted' > >>>>>>>>> @auth.requires_login() > >>>>>>>>> def run(): return service() > > >>>>>>>>> this should work but will require login for all services > > >>>>>>>>> @service.json() > >>>>>>>>> @auth.requires_login() > >>>>>>>>> def acceptme(): > >>>>>>>>> return 'accepted' > >>>>>>>>> def run(): return service() > > >>>>>>>>> this is not completely clear to me why does not work but I see > >>>>>>>>> some > >>>>>>>>> logical problems. > > >>>>>>>>> Massimo > > >>>>>>>>> On Jun 23, 7:31 pm, Hasanat Kazmi<hasanatka...@gmail.com> > >>>>>>>>> wrote: > > >>>>>>>>>> Here is an interesting behavior. > >>>>>>>>>> i have following function > > >>>>>>>>>> @auth.requires_login() > >>>>>>>>>> @service.json > >>>>>>>>>> @service.jsonrpc > >>>>>>>>>> def acceptme(): > >>>>>>>>>> return "accepted" > > >>>>>>>>>> in this case, whatever username and password I give, I get > >>>>>>>>>> returned > >>>>>>>>>> "accepted" but if I put @auth.requires_login() after > >>>>>>>>>> @service.jsonrpc, > >>>>>>>>>> it always returns me "Object does not exist" . > > >>>>>>>>>> I call it like > >>>>>>>>>> this:http://hasanatkazmi%40gmail.com:**...@localhost:8000/sahana/admin/cal > >>>>>>>>>> ... > > >>>>>>>>>> Anyone has an idea whats going on? > > >>>>>>>>>> On Jun 4, 7:28 am, Alexei Vinidiktov > >>>>>>>>>> <alexei.vinidik...@gmail.com> > >>>>>>>>>> wrote: > > >>>>>>>>>>> I've tried this with the pyjamas tutorial and it didn't work. > >>>>>>>>>>> I've > >>>>>>>>>>> enabled user registration and registered a user whose > >>>>>>>>>>> credentials are > >>>>>>>>>>> used in the URL below. I got a server error when a function > >>>>>>>>>>> requiring > >>>>>>>>>>> user authentication was called. > > >>>>>>>>>>> I changed the line > > >>>>>>>>>>> JSONProxy.__init__(self, "../../default/call/jsonrpc", > >>>>>>>>>>> ["getTasks", > >>>>>>>>>>> "addTask","deleteTask"]) > > >>>>>>>>>>> to read > > >>>>>>>>>>> JSONProxy.__init__(self, > >>>>>>>>>>> "http://myemail%40gmail.com%3amypassw...@127.0.0.1:8000/pyjamas/defaul > >>>>>>>>>>> ...", > >>>>>>>>>>> ["getTasks", "addTask","deleteTask"]) > > >>>>>>>>>>> What am I missing? > > >>>>>>>>>>> Thanks. > > >>>>>>>>>>> On Mon, Jun 1, 2009 at 12:51 PM, mdipierro > >>>>>>>>>>> <mdipie...@cs.depaul.edu> wrote: > > >>>>>>>>>>>> OK. As you request since the latest version in trunk you > >>>>>>>>>>>> can do > > >>>>>>>>>>>> @auth.requires_login() > >>>>>>>>>>>> def index(): return 'hello world' > > >>>>>>>>>>>> and access it with > > >>>>>>>>>>>> curl -u username:passwordhttp://127.0.0.1:8000/app/default/ > >>>>>>>>>>>> index > > >>>>>>>>>>>> or > > >>>>>>>>>>>> curlhttp://username:passw...@127.0.0.1:8000/app/default/ > >>>>>>>>>>>> index > > >>>>>>>>>>>> In the latter case username and password have to be encoded > >>>>>>>>>>>> by > >>>>>>>>>>>> urllib.quote() > > >>>>>>>>>>>> works for services too. > > >>>>>>>>>>>> Massimo > > >>>>>>>>>>>> On May 31, 10:43 pm, Dan<danbr...@gmail.com> wrote: > > >>>>>>>>>>>>> Since my last message on this thread, I came up with a patch > >>>>>>>>>>>>> to the > >>>>>>>>>>>>> Auth.login() code that lets me do what I need, so figured I > >>>>>>>>>>>>> should > >>>>>>>>>>>>> post it here. Let me know if you see any issues with this > >>>>>>>>>>>>> approach (or > >>>>>>>>>>>>> improvements to it). > > >>>>>>>>>>>>> To recap, what I want to do is to let a script runing wget > >>>>>>>>>>>>> (not a > >>>>>>>>>>>>> browser)loginand then work with some parts of the app that > >>>>>>>>>>>>> require > >>>>>>>>>>>>> membership in groups. I want to pass the user's name and > >>>>>>>>>>>>> password to > >>>>>>>>>>>>> theloginformusing post variables in the URL. This is not > >>>>>>>>>>>>> normally > >>>>>>>>>>>>> possible with web2py'sAuth.login() function, so it needs > >>>>>>>>>>>>> to be > >>>>>>>>>>>>> modified, like this- > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---