getting rid of from_map_line, never liked that odd method

This commit is contained in:
Lionel Dricot 2022-01-18 14:45:37 +01:00
parent 103610b077
commit 9b8c06efce

View File

@ -625,24 +625,7 @@ class GeminiItem():
else:
return "=> {}\n".format(self.url)
@classmethod
#Create a GeminiItem based on a gemini line
#also makes relative URL absolute
def from_map_line(cls, line, origin_gi):
assert line.startswith("=>")
assert line[2:].strip()
bits = line[2:].strip().split(maxsplit=1)
bits[0] = origin_gi.absolutise_url(bits[0])
if looks_like_url(bits[0]):
try:
newgi = cls(*bits)
return newgi
except:
return None
else:
return None
CRLF = '\r\n'
CRLF = '\r\n'
# Cheap and cheerful URL detector
def looks_like_url(word):