URLPath should have an inverse to child() and here() isn't really here()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 10
Description
| magmatt reported | |
|---|---|
| Trac ID | trac#6673 |
| Type | enhancement |
| Created | 2013-08-07 17:20:59Z |
| Branch | https://github.com/twisted/twisted/tree/url-up-here-6673 |
URLPath.parent is not the inverse of URLPath.child, which is unexpected:
>>> from twisted.python.urlpath import URLPath
>>> u = URLPath.fromString('http://example.com/foo/bar/baz')
>>> print u
http://example.com/foo/bar/baz
>>> print u.child('hey').parent()
http://example.com/foo/bar/
And I would expect URLPath.here() to be the way to get a URL without query parameters, but it's not:
>>> from twisted.python.urlpath import URLPath
>>> u = URLPath.fromString('http://example.com/foo/bar/baz?foo=1')
>>> print u
http://example.com/foo/bar/baz?foo=1
>>> print u.here()
http://example.com/foo/bar/
I propose adding two new methods that let you:
- Perform the inverse of .child('foo')
- Access the current url without query parameters.
(I apologize, but I just read in the docs that I should submit the ticket before writing a patch -- sorry)
Attachments:
- urlpath.patch (2334 bytes) - added by magmatt on 2013-08-07 17:21:08Z -
- 6673.2.patch (10622 bytes) - added by magmatt on 2013-09-19 16:14:00Z -
Searchable metadata
trac-id__6673 6673
type__enhancement enhancement
reporter__magmatt magmatt
priority__normal normal
milestone__
branch__branches_url_up_here_6673 branches/url-up-here-6673
branch_author__jonathanj jonathanj
status__new new
resolution__None None
component__core core
keywords__url url
time__1375896059000000 1375896059000000
changetime__1383471045000000 1383471045000000
version__None None
owner__
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in twisted.python.urlpath.URLPath and review the examples showing the behavior of parent(), child(), and here(). Check the existing url-up-here-6673 branch and attached patches, then verify that the requested inverse operation and query-free current URL behavior are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100