getting rid of from_map_line, never liked that odd method
This commit is contained in:
parent
103610b077
commit
9b8c06efce
19
offpunk.py
19
offpunk.py
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user