~vomun-developers/anonplus/vomun-trunk

« back to all changes in this revision

Viewing changes to src/uis/web/manager.py

  • Committer: AJ00200
  • Date: 2011-11-25 21:30:53 UTC
  • Revision ID: git-v1:adec72eb3a3f154a85bce3e01e408b6e40b3d3da
Basic structure for database storage. Also added a start function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
4
4
import libs.threadmanager
5
5
import uis.web.handler
 
6
import libs.globals
6
7
import libs.events
7
 
import libs
8
8
 
9
9
 
10
10
class MyHandler(BaseHTTPRequestHandler):
11
11
    '''Handles events from the web server and passes them out as events to
12
12
    libs.events via the broadcast function. The event is sent to the
13
13
    web_ui_request method of all registered event handlers.'''
14
 
 
 
14
    
15
15
    def do_GET(self):
16
16
        '''Handle GET requests'''
17
17
        libs.events.broadcast('web_ui_request', self.path, self)
24
24
##            if ctype == 'multipart/form-data':
25
25
##                query = cgi.parse_multipart(self.rfile, pdict)
26
26
##            self.send_response(301)
27
 
##
 
27
##            
28
28
##            self.end_headers()
29
29
##            upfilecontent = query.get('upfile')
30
30
##            print('filecontent', upfilecontent[0])
31
31
##            self.wfile.write('<html>POST OK.<br /><br />');
32
32
##            self.wfile.write(upfilecontent[0]);
33
 
##
 
33
##            
34
34
##        except:
35
35
##            pass
36
36
 
48
48
                print('^C received, shutting down web server')
49
49
                self.server.socket.close()
50
50
                self._stop.set()
51
 
 
52
 
## Start the server and handler
 
51
            
 
52
## Start the server and handler            
53
53
def start():
54
54
    '''Start the user interface. Create the Server object and the listener
55
55
    we use to listen for events from this interface.