1 import mechanize
2
4 """An abstract functionality of a web browser"""
5
6 - def open(self, address):
7 """Open a web page with a given address"""
8 raise NotImplementedError
9
11 """
12 Return a copy of the currently opened web page
13
14 @rtype: file-like object
15 """
16 raise NotImplementedError
17
18 - def back(self, steps=1):
19 """Go back C{steps} steps in history"""
20 raise NotImplementedError
21
23 """The 'Creator' class from the Factory Method design pattern"""
24
26 """
27 Create a browser. This method has to be thread-safe since it is
28 called as the method of the same object in different threads.
29
30 @rtype: L{AbstractWebBrowser}
31 """
32 raise NotImplementedError
33
34
36 """The default browser. It uses C{mechanize} library"""
37
39 self.__br = mechanize.Browser()
40
41 - def open(self, address):
42 self.__br.open(address)
43
46
47 - def back(self, steps=1):
49
53