|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 - 2016 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a structure to hold the data for a speed dial page. |
|
8 """ |
|
9 |
|
10 |
|
11 from __future__ import unicode_literals |
|
12 |
|
13 |
|
14 class Page(object): |
|
15 """ |
|
16 Class to hold the data for a speed dial page. |
|
17 """ |
|
18 def __init__(self, url="", title="", broken=False): |
|
19 """ |
|
20 Constructor |
|
21 |
|
22 @param url URL of the page (string) |
|
23 @param title title of the page (string) |
|
24 @param broken flag indicating a broken connection (boolean) |
|
25 """ |
|
26 self.url = url |
|
27 self.title = title |
|
28 self.broken = broken |
|
29 |
|
30 def __eq__(self, other): |
|
31 """ |
|
32 Special method implementing the equality operator. |
|
33 |
|
34 @param other reference to the other page object (Page) |
|
35 @return flag indicating equality (boolean) |
|
36 """ |
|
37 return self.title == other.title and \ |
|
38 self.url == other.url |
|
39 |
|
40 def isValid(self): |
|
41 """ |
|
42 Public method to check the validity. |
|
43 |
|
44 @return flag indicating a valid object |
|
45 @rtype bool |
|
46 """ |
|
47 return bool(self.url) |