radical-cybertools / radical.utils

Utility classes and tools for various radical projects
Other
8 stars 6 forks source link

inconsistent "defaults" in Url() #17

Closed marksantcroos closed 10 years ago

marksantcroos commented 10 years ago
>>> u = radical.utils.Url('/Users/mark/pretty_picture_of_andre.png')
>>> u.schema
''
>>> u.host
>>>
andre-merzky commented 10 years ago
>>> import radical.utils as ru
>>> u = ru.Url ('/etc/passwd')
>>> u.host
>>> u.schema
>>> 
andre-merzky commented 10 years ago

I had to switch the default from None to empty string -- the urlparser we use depends on non-existing elements being empty strings, and will otherwise raise exceptions in several places. Fixing that behavior doesn't seem easy, so as long as we are stuck with that parser, strings it is. Note that the default for port remains None -- this is an int, and zero as value does not make sense, and triggers the inclusion of the zero port in all URL serializations...