Changeset 246


Ignore:
Timestamp:
07/16/07 12:50:30 (5 years ago)
Author:
marc
Message:

Abstracted IconResource? to FileResource? to be reused. Fixed some typos from renaming in Console and removed useless destructor. Updated changelog.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r245 r246  
    44 * Added RPM packages 
    55 * Added a favicon to the server 
     6 * Don't clean out status labels when restarting server 
     7 * Don't check for system compatibility of Libnotify 
     8 * Cleaning of the code to try to be at least more compatible with PEP-8 
    69 * Simplified and improved Makefile 
    7  * Cleaning of the code to try to be at least more compatible with PEP-8 
    8  * Dont clean out status labels when restarting server 
    910 
    10110.2.1: 
  • trunk/console.py

    r241 r246  
    129129        Constructor for console output handler 
    130130         
    131         @type itakaglobals: module 
    132         @param itakaglobals: Configuration module globals 
     131        @type itaka_globals: module 
     132        @param itaka_globals: Configuration module globals 
    133133        """ 
    134134 
    135135        self.itaka_globals = itaka_globals 
    136136        if self.itaka_globals.console_verbosity['normal']:  
    137             BaseMessage(_('Itaka %s starting') % (itakaglobals.version)) 
     137            BaseMessage(_('Itaka %s starting') % (self.itaka_globals.__version__)) 
    138138             
    139     def __del__(self): 
    140         """ 
    141         Destructor 
    142         """ 
    143          
    144         if self.itaka_globals.console_verbosity['normal']:  
    145             BaseMessage(_('Itaka shutting down')) 
    146  
    147139    def message(self, message): 
    148140        """ 
  • trunk/server.py

    r245 r246  
    200200        self.add_child_to_resource('root', '', self.root) 
    201201        self.add_child_to_resource('root', 'screenshot', ScreenshotResource(self.gui, self.authresource)) 
    202         self.add_child_to_resource('root', 'favicon.ico', IconResource(self.gui, self.authresource)) 
     202        self.add_child_to_resource('root', 'favicon.ico', FileResource(self.gui, self.authresource, os.path.join(self.itaka_globals.image_dir, 'favicon.ico'), 'image/x-icon')) 
     203 
    203204        self.create_site(self.root) 
    204205 
     
    454455            return self.data 
    455456 
    456 class IconResource(resource.Resource): 
     457class FileResource(resource.Resource): 
    457458    """  
    458     Handle server requests and call for favicon.ico 
    459     """ 
    460  
    461     def __init__(self, gui_instance, auth_instance): 
     459    Generic handler for file resources 
     460    """ 
     461 
     462    def __init__(self, gui_instance, auth_instance, path, type): 
    462463        """  
    463464        Constructor 
     
    468469        @type auth_instance: AuthenticatedResource 
    469470        @param auth_instance: An instance of our L{AuthenticatedResource} class 
     471 
     472        @type path: string 
     473        @param path: The path to the file to be served 
     474 
     475        @type type: str 
     476        @param type: The MIME-type to bepassed to Content-Type 
    470477        """ 
    471478 
     
    474481        self.itaka_globals = self.gui.itaka_globals 
    475482 
     483        self.type = type 
     484        self.data = open(path, 'rb').read() 
     485        self.size = str(os.stat(path).st_size) 
     486 
    476487    def render_GET(self, request): 
    477488        """ 
     
    484495        self.configuration = self.gui.configuration 
    485496        self.request = request 
    486         self.type = 'image/x-icon' 
    487         self.file = os.path.join(self.itaka_globals.image_dir, 'favicon.ico') 
    488         self.data = open(self.file, 'rb').read() 
    489         self.size = str(os.stat(self.file).st_size) 
    490497 
    491498        if self.configuration['server']['authentication']: 
  • trunk/uigtk.py

    r244 r246  
    12141214 
    12151215        if self.server.listening(): 
    1216             self.console.message(_('Shutting down server')) 
    12171216            self.server.stop_server() 
    1218             del self.console 
    1219         else: 
    1220             # Console goodbye! 
    1221             if hasattr(self, 'console'): 
    1222                 del self.console 
    12231217 
    12241218        # Remove stale screenshot and quit 
     
    12291223        del self.status_icon 
    12301224 
     1225        self.console.message(_('Itaka shutting down')) 
    12311226        gtk.main_quit() 
    12321227 
Note: See TracChangeset for help on using the changeset viewer.