On Tuesday, August 30, 2016 at 3:46:21 PM UTC-7, Alex Glaros wrote: > > .load file sends parent URL to a controller in long form, including alll > parts of the URL: > controller_to_return_to=request.env.http_web2py_component_location > > controller then does a redirect to parent > > how to get the abreviated form of the URL? The original var > controller_to_return_to looks like this when sent through the "Sure you > want to delete?" URL: > > http://127.0.0.1:8000/ES3/default/http://127.0.0.1%3A8000/ES3/default/documentation_professional_licensing_collaborative_data_model%23comments > > I had to resort to this: > > new_controller_index = max(loc for loc, val in > enumerate(controller_to_return_to) if val == '/') # First find the last > slash in the string > extra_controller = controller_to_return_to[(new_controller_index+1):] > # strip off extra URL characters. Looks hacky. > form = FORM.confirm('Sure you want to delete this > comment?',{'Back':URL(extra_controller)}) > > better way? > > thanks, > > Alex Glaros >
Maybe Python's urlparse library? /dps -- 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 this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.