Exemplo n.º 1
0
 def _handle_connection( self, conn, address ):
     ssloptions = h.settingsfor( 'ssloptions.', self.sett )
     is_ssl = ssloptions['keyfile'] and ssloptions['certfile']
     if is_ssl :
         try:
             conn = ssl.wrap_socket( conn,
                                     server_side=True,
                                     do_handshake_on_connect=False,
                                     **ssloptions )
         except ssl.SSLError as err:
             if err.args[0] == ssl.SSL_ERROR_EOF:
                 return conn.close()
             else:
                 raise
         except socket.error as err:
             if err.args[0] == errno.ECONNABORTED:
                 return conn.close()
             else:
                 raise
     try:
         if is_ssl :
             stream = HTTPSSLIOStream( 
                         conn, address, self.ioloop, 
                         self.sett, ssloptions=ssloptions )
         else :
             stream = HTTPIOStream( conn, address, self.ioloop, self.sett ) 
         self.handle_stream( stream, address )
     except Exception:
         #log.error("Error in connection callback", exc_info=True)
         pass
Exemplo n.º 2
0
    def boot(cls, baseini, *args, **kwargs):
        """Boot the platform using master configuration file ``baseini``.  
        Return a new instance of this class object. This is the only way to
        create a platform instance.
        """
        configdb = Pluggdapps._preboot(cls, baseini, *args, **kwargs)

        pa = cls(*args, **kwargs)
        pa.inifile = baseini
        pa.settings = pa._loadsettings(baseini)
        pa.configdb = configdb

        # Configuration from backend store
        dbsett = pa.configdb.config()
        if dbsett:
            [pa.settings[section].update(d) for section, d in dbsett.items()]

        # Logging related settings go under `[pluggdapps]` section
        pa.logsett = h.settingsfor("logging.", pa.settings["pluggdapps"])

        return pa
Exemplo n.º 3
0
    def boot(cls, baseini, *args, **kwargs):
        """Boot the platform using master configuration file ``baseini``.  
        Return a new instance of this class object. This is the only way to
        create a platform instance.
        """
        configdb = Pluggdapps._preboot(cls, baseini, *args, **kwargs)

        pa = cls(*args, **kwargs)
        pa.inifile = baseini
        pa.settings = pa._loadsettings(baseini)
        pa.configdb = configdb

        # Configuration from backend store
        dbsett = pa.configdb.config()
        if dbsett:
            [pa.settings[section].update(d) for section, d in dbsett.items()]

        # Logging related settings go under `[pluggdapps]` section
        pa.logsett = h.settingsfor('logging.', pa.settings['pluggdapps'])

        return pa
Exemplo n.º 4
0
    def _preboot(cls, baseini, *args, **kwargs):
        """Prebooting. We need pre-booting because package() entry point can
        have option of creating dynamic plugins when it is called. The
        package() entry point for each and every package will be called only
        when callpackages() is called. Since callpackages() need a platform
        context, we first pre-boot the system and then actually boot the 
        system."""

        from pluggdapps import callpackages

        pa = Pluggdapps(*args, **kwargs)
        pa.settings = pa._loadsettings(baseini)

        # Configuration from backend store.
        storetype = pa.settings["pluggdapps"]["configdb"]
        configdb = pa.qp(pa, IConfigDB, storetype)
        configdb.dbinit()
        dbsett = configdb.config()
        if dbsett:
            [pa.settings[section].update(d) for section, d in dbsett.items()]

        pa.logsett = h.settingsfor("logging.", pa.settings["pluggdapps"])
        callpackages(pa)
        return configdb
Exemplo n.º 5
0
    def _preboot(cls, baseini, *args, **kwargs):
        """Prebooting. We need pre-booting because package() entry point can
        have option of creating dynamic plugins when it is called. The
        package() entry point for each and every package will be called only
        when callpackages() is called. Since callpackages() need a platform
        context, we first pre-boot the system and then actually boot the 
        system."""

        from pluggdapps import callpackages

        pa = Pluggdapps(*args, **kwargs)
        pa.settings = pa._loadsettings(baseini)

        # Configuration from backend store.
        storetype = pa.settings['pluggdapps']['configdb']
        configdb = pa.qp(pa, IConfigDB, storetype)
        configdb.dbinit()
        dbsett = configdb.config()
        if dbsett:
            [pa.settings[section].update(d) for section, d in dbsett.items()]

        pa.logsett = h.settingsfor('logging.', pa.settings['pluggdapps'])
        callpackages(pa)
        return configdb
Exemplo n.º 6
0
 def __init__(self):
     setts = h.settingsfor('tayra.ttlcompiler.', self['siteconfig'])
     setts.update(debug=True)
     self.ttlplugin = \
         self.qp( pluggdapps.interfaces.ITemplate, 'tayra.TTLCompiler',
                  settings=setts )
Exemplo n.º 7
0
 def __init__(self) :
     setts = h.settingsfor( 'tayra.ttlcompiler.', self['siteconfig'] )
     setts.update( debug=True )
     self.ttlplugin = \
         self.qp( pluggdapps.interfaces.ITemplate, 'tayra.TTLCompiler',
                  settings=setts )