Lines Matching refs:self

5   def create(self, i_url, i_root, i_re_neg = "", i_title = ""):  argument
9 self.relative_url = i_url
10 self.title = i_title
11 self.full_url = self.merge_url(i_url, i_root)
12 if self.full_url is None:
18 if not(r.match(self.full_url) is None):
24 self.netloc = urlparse.urlparse(self.full_url).netloc
27 def merge_url(self, i_url, i_root): argument
71 def __init__(self): argument
73 self.place_from = place()
74 self.place_to = place()
75 self.caption = ""
81 def __init__(self): argument
83 self.places = []
84 self.links = []
86 def add_place(self, i_place): argument
87 ret_place = self.find_place(i_place)
89 self.places.append(i_place)
94 def find_place(self, i_place): argument
95 for i in self.places:
100 def add_link(self, i_place_from, i_place_to, i_caption, i_root_url = ""): argument
115 i_caption = self.escape_html(i_place_to.full_url)
118 lnk.place_from=self.add_place(i_place_from)
119 lnk.place_to =self.add_place(i_place_to)
121 self.links.append(lnk)
124 def has_page_from_role(self, i_page): argument
126 for lnk in self.links:
131 def escape_html(self, i_link): argument
139 def process_site(self, i_url, i_counter = 100, i_re_neg = ""): argument
143 self.loop_counter = self.loop_counter + 1
145 if self.root_netloc == "":
147 self.root_netloc = p.netloc
148 self.root_url = i_url
150 self.url = i_url
151 self.negative_regexp = i_re_neg
157 self.parse(s)
164 next_url = self.get_next_url()
166 if (next_url is None) or (self.loop_counter > i_counter):
171 self.process_site(next_url, i_counter, i_re_neg)
175 def parse(self, s): argument
177 self.feed(s)
178 self.close()
180 def __init__(self, verbose=0): argument
182 sgmllib.SGMLParser.__init__(self, verbose)
183 self.network = network()
184 self.page_counter = 0
185 self.root_netloc = ""
186 self.exp_branch = []
187 self.str_indent = ""
188 self.tag_value = []
189 self.curr_ahref = ""
190 self.curr_title = ""
191 self.curr_ahref_title = ""
192 self.interesting_tag = 0
193 self.loop_counter = 0
194 self.negative_regexp = ""
195 self.root_url = ""
197 def start_a(self, attributes): argument
199 self.curr_ahref = ""
200 self.curr_ahref_title = ""
201 self.tag_value = []
202 self.interesting_tag = 0
206 self.curr_ahref = value
207 if self.curr_ahref[0] == "#":
209 self.interesting_tag = 0
211 self.interesting_tag = 1
214 self.curr_ahref_title = value
216 def end_a(self): argument
218 if self.interesting_tag == 0:
222 if len(self.curr_ahref) > 0:
224 if self.curr_ahref[0] == "#":
225 self.curr_ahref = self.url + self.curr_ahref
227 title = string.join(self.tag_value, "").strip()
229 title = self.curr_ahref_title
233 res_from = p_from.create("", self.url, self.negative_regexp, self.curr_title)
235 res_to = p_to.create(self.curr_ahref, self.url, self.negative_regexp)
237 self.interesting_tag = 0
241 self.network.add_link(p_from, p_to, title, self.root_url)
243 def start_title(self, attributes): argument
245 self.interesting_tag = 1
246 self.tag_value = []
249 def end_title(self): argument
251 self.interesting_tag = 0
252 self.curr_title = string.join(self.tag_value, "").strip()
255 def handle_data(self, data): argument
257 if self.interesting_tag == 1:
258 self.tag_value.append(data)
261 def print_hyperlinks(self): argument
263 for lnk in self.network.links:
268 def export_item(self, i_place, i_caption, i_indent, i_parent_url = "", i_root_url = ""): argument
279 i_root_url = self.root_url
281 is_branch = self.network.has_page_from_role(i_place)
284 self.str_indent = " " * i_indent
285 for exp in self.exp_branches:
292self.printx("<branchLink id=\"" + self.network.escape_html(exp.full_url) + "\" link=\"" + self.net…
293 self.printx(" <branchText>" + i_caption + "</branchText>")
294 self.printx("</branchLink>")
303 self.exp_branches.append(i_place)
304self.printx("<branch id=\"" + self.network.escape_html(i_place.full_url) + "\" link=\"" + self.net…
305 self.printx(" <branchText>" + i_caption + "</branchText>")
306 freeze_indent = self.str_indent
308 for lnk in self.network.links:
310 self.export_item(lnk.place_to, lnk.caption, i_indent + 1, i_place.full_url, i_root_url)
312 self.str_indent = freeze_indent
313 self.printx("</branch>")
315 self.printx("<leaf link=\"" + self.network.escape_html(i_place.full_url) + "\">")
316 self.printx(" <leafText>" + i_caption + "</leafText>")
317 self.printx("</leaf>")
320 def export_hyperlinks(self): argument
322 self.exp_branches = []
323 self.printx("""<?xml version='1.0' encoding='windows-1250'?>
327 self.export_item(self.network.links[0].place_from, self.network.links[0].caption, 1)
328 self.str_indent = ''
329 self.printx("</tree>")
332 def get_next_url(self): argument
334 start_cnt = self.page_counter
335 for pg in self.network.places[start_cnt:]:
336 self.page_counter = self.page_counter + 1
338 if not self.network.has_page_from_role(pg):
345 def printx(self, i_str): argument
347 print self.str_indent + i_str