Closed sleep-walker closed 10 years ago
I think safe_base could be an attribute instead of a method, so can you please set self.safe_base in the constructor?
Also, did you check into using liburl.parse? That may make it easier to get rid of the username and password without using re.
Thanks,
William
First part was easy.
Second - I'm no Pythonist and I have no knowledge of liburl (and what I found on Google didn't seem relevant for URL manipulation). On the other hand regular expressions are my mother tongue.
I found urllib.parse and produced:
parse_result = urllib.parse.urlparse(self.base)
new_netloc = parse_result.netloc.split('@')[-1]
safe_base = parse_result._replace(netloc=new_netloc).geturl()
Do you find it more elegant?
Yes, the reason being that it doesn't matter whether the url is http or https, and I think it did with your regular expression. One more small change: Please move those three lines down to be directly above this one, and add a blank line:
if getattr(self, 'encoding', None) is not none:
I would rather figure out safe_base after we have all of the parameters from the config file and command line parsed.
Thanks,
William
fix for https://github.com/williamh/pybugz/issues/76