URI should support copy
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.uri |
Triaged
|
Low
|
Unassigned |
Bug Description
I have seen several example in our code where a URI is converted to a string, then used to make a new URL without take advantage of the URI's safety. The problem stems in that the code does not want to alter the URI. The code wants to do something like this:
return str(URI(
I propose that URI() can accept an instance of itself and it will copy the instance attributes. If we change URI.__init__() from:
if uri is not None:
to
if uri is not None and isinstance(uri, self.__class__):
elif uri is not None:
It will support copy.
Changed in launchpad: | |
status: | New → Triaged |
affects: | launchpad-foundations → lazr.uri |
Changed in lazr.uri: | |
importance: | Undecided → Low |