[Patches] [ python-Patches-624325 ] attributes for urlsplit, urlparse result

SourceForge.net noreply at sourceforge.net
Sat Apr 2 18:44:36 CEST 2005


Patches item #624325, was opened at 2002-10-16 23:59
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=624325&group_id=5470

Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Fred L. Drake, Jr. (fdrake)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: attributes for urlsplit, urlparse result

Initial Comment:
This patch to Lib/urlparse.py makes the fields of the
results accessible as named attributes from the result
object.  The result objects are still small since they
derive from tuple and have no __dict__, though there's
some additional cost in construction (a temporary tuple
is created and passed to tuple.__new__).

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-04-02 18:44

Message:
Logged In: YES 
user_id=1188172

Here is a diff to the patch that corrects the
\versionchanged commands and the use of the geturl() in the
example:


--- urlparse.patch      2005-04-02 18:38:06.979685348 +0200
+++ urlparse-new.patch  2005-04-02 18:42:03.124933001 +0200
@@ -168,7 +168,7 @@
  ('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '', '', '')
 +>>> o.scheme
 +'http'
-+>>> o.url
++>>> o.geturl()
 +'http://www.cwi.nl:80/%7Eguido/Python.html'
  \end{verbatim}

@@ -189,7 +189,7 @@
 +\var{urlstring}.
 +
 +\versionchanged[Support for attributes on the result
object was
-+                added]{2.3}
++                added]{2.5}
  \end{funcdesc}

  \begin{funcdesc}{urlunparse}{tuple}
@@ -236,7 +236,7 @@
 +
  \versionadded{2.2}
 +\versionchanged[Support for attributes on the result
object was
-+                added]{2.3}
++                added]{2.5}
  \end{funcdesc}

  \begin{funcdesc}{urlunsplit}{tuple}

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2004-10-17 21:10

Message:
Logged In: YES 
user_id=3066

I've attached a new version of the patch that simplifies the
code for the new types.

It doesn't look like I'll bet getting to magic structseq
support anytime soon.  I'm also no longer convinced that
this needs to be held up for that.  This should be
considered for Python 2.5 on the basis of the feature; the
implementation can be changed some someone get around to
creation of structseq types from Python.


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-14 18:37

Message:
Logged In: YES 
user_id=6380

I'm fine with this, but we decided to use a different
approach (for the same effect): make structseq usable from
Python code. That's being discussed in bug 624827. Pending
that, this one's on hold.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-10-17 22:03

Message:
Logged In: YES 
user_id=3066

Based on comments from Guido, provide a geturl() method
instead of the url property, since it actually does more
work than just retrieving data.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-10-17 19:09

Message:
Logged In: YES 
user_id=3066

New version of the patch.

This adds a "url" attribute to each type of result,
providing the result of urlunsplit() / urlunparse() for the
components of the result object.

Tests and documentation have been updated.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=624325&group_id=5470


More information about the Patches mailing list