Ticket #1649 (closed defect: fixed)
Port tg.url() to TG2
| Reported by: | mramm | Owned by: | seanodonnell |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | TurboGears | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Port the tg.url function to tg2.
Attachments
Change History
comment:2 Changed 4 years ago by max
- Owner changed from anonymous to max
- Status changed from new to assigned
I guess new impl. should be using WebOb?, http://pythonpaste.org/webob/#urls?
comment:3 Changed 4 years ago by max
got stuck. I'm writing a unit test and I need a way to setup pylons.request so that I can test the url().
comment:4 Changed 4 years ago by max
- Owner changed from max to anonymous
- Status changed from assigned to new
give up.
I implemented a create_request() function so that url() can tested easily. But it seems to me that re-writing it to work with newer webob yet be compatible with TG1 would take too much time. And it's not clear whether its worth it. I move on to other things, feel free to pick the ticket up.
P.S.: My "naive" code looked like this:
def url(tgpath, tgparams=None, **kw): from tg import request if not isinstance(tgpath, basestring): tgpath = "/".join(list(tgpath)) path = request.relative_url(tgpath) base_url = request.path_url return path[len(base_url):] def test_url(): create_request('/') eq_('hello', url('hello')) eq_('/hello', url('/hello'))
comment:6 Changed 4 years ago by stefanha
- Owner changed from anonymous to stefanha
- Status changed from new to assigned
Will start by porting TG1 unit tests.
comment:7 Changed 4 years ago by stefanha
- Owner changed from stefanha to anonymous
- Status changed from assigned to new
Giving up, too. Looking at url() in TG1, redirect() could share code with url().
I have attached a patch against rev 3887. It contains incomplete work, including unit tests ported from TG1.
comment:10 Changed 4 years ago by mramm
- Status changed from new to closed
- Resolution set to fixed
The TG portion of this is fixed, waiting on some changes in webob.
comment:11 Changed 3 years ago by anonymous
- Milestone 2.0-preview-1 deleted
Milestone 2.0-preview-1 deleted

Port the tg.url function to tg2. The origonal can be found at:
source:/branches/1.0/turbogears/controllers.py line 477