(self, url)
extract host and port from an URL string
extract host and port from an URL string
extract host and port from an URL string
def fromURL(self, url):
        """extract host and port from an URL string"""
        if url.lower().startswith("loop://"): url = url[7:]
        try:
            # process options now, directly altering self
            for option in url.split('/'):
                if '=' in option:
                    option, value = option.split('=', 1)
                else:
                    value = None
                if not option:
                    pass
                elif option == 'logging':
                    logging.basicConfig()   # XXX is that good to call it here?
                    self.logger = logging.getLogger('pySerial.loop')
                    self.logger.setLevel(LOGGER_LEVELS[value])
                    self.logger.debug('enabled logging')
                else:
                    raise ValueError('unknown option: %r' % (option,))
        except ValueError, e:
            raise SerialException('expected a string in the form "[loop://][option[/option...]]": %s' % e)
def fromURL ( self , url ) : if url . lower ( ) . startswith ( "loop://" ) : url = url [ 7 : ] try : # process options now, directly altering self for option in url . split ( '/' ) : if '=' in option : option , value = option . split ( '=' , 1 ) else : value = None if not option : pass elif option == 'logging' : logging . basicConfig ( ) # XXX is that good to call it here? self . logger = logging . getLogger ( 'pySerial.loop' ) self . logger . setLevel ( LOGGER_LEVELS [ value ] ) self . logger . debug ( 'enabled logging' ) else : raise ValueError ( 'unknown option: %r' % ( option , ) ) except ValueError , e : raise SerialException ( 'expected a string in the form "[loop://][option[/option...]]": %s' % e )