returns the index of certain set of attributes (of a link) in the self.a list If the set of attributes is not found, returns None
(self, attrs)
| 202 | self.handle_tag(tag, None, 0) |
| 203 | |
| 204 | def previousIndex(self, attrs): |
| 205 | """ returns the index of certain set of attributes (of a link) in the |
| 206 | self.a list |
| 207 | |
| 208 | If the set of attributes is not found, returns None |
| 209 | """ |
| 210 | if not has_key(attrs, 'href'): return None |
| 211 | |
| 212 | i = -1 |
| 213 | for a in self.a: |
| 214 | i += 1 |
| 215 | match = 0 |
| 216 | |
| 217 | if has_key(a, 'href') and a['href'] == attrs['href']: |
| 218 | if has_key(a, 'title') or has_key(attrs, 'title'): |
| 219 | if (has_key(a, 'title') and has_key(attrs, 'title') and |
| 220 | a['title'] == attrs['title']): |
| 221 | match = True |
| 222 | else: |
| 223 | match = True |
| 224 | |
| 225 | if match: return i |
| 226 | |
| 227 | def handle_tag(self, tag, attrs, start): |
| 228 | #attrs = fixattrs(attrs) |