Changeset 87

Show
Ignore:
Timestamp:
06/13/07 20:56:11
Author:
bbangert
Message:

PEP 8 cleanups.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • AuthKit/branches/0.4/authkit/authenticate/__init__.py

    r83 r87  
    4949 
    5050from authkit.authorize import authorize_request 
    51 from authkit.permissions import RemoteUser, no_authkit_users_in_environ, AuthKitConfigError 
     51from authkit.permissions import RemoteUser, no_authkit_users_in_environ, \ 
     52    AuthKitConfigError 
    5253 
    5354# Setting up logging 
     
    163164                function = digest_password 
    164165            else: 
    165                 raise Exception('Invalid format for authenticate function %r'%format) 
     166                raise Exception('Invalid format for authenticate function %r'  
     167                                % format) 
    166168    return app, function, users 
    167169 
     
    190192                                 (', '.join(template_conf.keys()))) 
    191193    if template_conf.keys()[0] not in ['string', 'file', 'obj']: 
    192         raise AuthKitConfigError("Template option can only be 'string', 'file' or 'obj'") 
     194        raise AuthKitConfigError("Template option can only be 'string', 'file'" 
     195                                 " or 'obj'") 
    193196    if template_conf.keys()[0] == 'string': 
    194197        template = template_conf['string'] 
    195198    elif template_conf.keys()[0] == 'file': 
    196199        if not os.path.exists(template_conf['file']): 
    197             raise AuthKitConfigError( 
    198                 'No such file %r exists. It was specified by config option %r'%( 
    199                     template_conf['file'], 
    200                     prefix+'file' 
    201                 ) 
    202             ) 
     200            raise AuthKitConfigError('No such file %r exists. It was specified' 
     201                                     ' by config option %r' %  
     202                                     (template_conf['file'], prefix+'file')) 
    203203        fp = open(template_conf['file'], 'r') 
    204204        template = fp.read() 
    205205        fp.close() 
    206206        if not template: 
    207             raise AuthKitConfigError( 
    208                 'No data in template file %s specified by config option %r'%( 
    209                     template_conf['file'], 
    210                     prefix+'file' 
    211                 ) 
    212             ) 
     207            raise AuthKitConfigError('No data in template file %s specified by' 
     208                                     ' config option %r' %  
     209                                     (template_conf['file'], prefix+'file')) 
    213210    elif template_conf.keys()[0] == 'obj': 
    214211        template = eval_import(template_conf['obj']) 
    215212        if not template: 
    216             raise AuthKitConfigError( 
    217                 'No data in template obj %s specified by config option %r'%( 
    218                     template_conf['obj'], 
    219                     prefix+'obj' 
    220                 ) 
    221             ) 
     213            raise AuthKitConfigError('No data in template obj %s specified by ' 
     214                                     'config option %r' %  
     215                                     (template_conf['obj'], prefix+'obj')) 
    222216    else: 
    223         raise AuthKitConfigError("Unknown option %r"%(prefix+template_conf.keys()[0])) 
     217        raise AuthKitConfigError("Unknown option %r" %  
     218                                 (prefix+template_conf.keys()[0])) 
    224219    if not template: 
    225220        raise AuthKitConfigError("The template loaded did not contain any data") 
     
    265260        self.key = key 
    266261        self.missing_error = missing_error or \ 
    267             'Missing the key %(key)s from the environ. Have you setup the correct middleware?' 
     262            'Missing the key %(key)s from the environ. Have you setup the ' \ 
     263            'correct middleware?' 
    268264         
    269265    def __call__(self, environ, start_response): 
     
    305301               handle_httpexception=True, **options):    
    306302    """ 
    307     This function sets up the AuthKit authenticate middleware and its use and options 
    308     are described in detail in the AuthKit manual. 
     303    This function sets up the AuthKit authenticate middleware and its use and  
     304    options are described in detail in the AuthKit manual. 
    309305    
    310306    The function takes the following arguments and returns a WSGI application  
    311     wrapped in the appropriate AuthKit authentication middleware based on the options specified: 
     307    wrapped in the appropriate AuthKit authentication middleware based on the  
     308    options specified: 
    312309 
    313310    ``app`` 
     
    315312 
    316313    ``app_conf`` 
    317         A paste deploy ``app_conf`` dictionary to be used to setup the middleware 
     314        A paste deploy ``app_conf`` dictionary to be used to setup the  
     315        middleware 
    318316 
    319317    ``global_conf`` 
     
    322320    ``config_file`` 
    323321        The URI to a config file in the paste deploy format to be used to setup 
    324         the middleware. The URI is relative to the current working directory and 
    325         should look something like ``config://dir/test.ini``. See the Paste Deploy 
    326         documentation for more information. 
     322        the middleware. The URI is relative to the current working directory  
     323        and should look something like ``config://dir/test.ini``. See the Paste 
     324        Deploy documentation for more information. 
    327325 
    328326    ``prefix`` 
     
    332330 
    333331    ``**options`` 
    334         Any AuthKit options which are setup directly in Python code. If specified,  
    335         these options will override any options specifed in a config file. 
     332        Any AuthKit options which are setup directly in Python code. If  
     333        specified, these options will override any options specifed in a config 
     334        file. 
    336335 
    337336    Only one of ``config_paste`` and ``config_file`` can be specified. All