Re: [viewvc-dev] ViewVC 1.1

"C. Michael Pilato" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Organization CollabNet, Inc.
Message-ID <47E1473C.3040508__15046.9296066605$1205946236$gmane$org@collab.net>
Phil Pinkerton wrote:
> So what your saying is that for "__init_.py"  in 
> viewvc-1.1-dev-2008318/lib/vcauth/forbiddenre this is the correct code ?
> 
> snip ....
> 
> class ViewVCAuthorizer(vcauth.GenericViewVCAuthorizer):
>   """A simple regular-expression-based authorizer."""
>   def __init__(self, username, params={}):
>     forbidden = params.get('forbidden', '')
>     self.forbidden = map(lambda x: _split_regexp(string.strip(x)),
>                          filter(None, string.split(forbidden, ',')))

That's exactly what I'm saying.  The code is looking for the configuration 
option named "forbidden" in the params dictionary.  That params dictionary 
is provided by the caller, who gets it from the 
lib/config.py:get_authorizer_params(), which basically just stuffs into 
params all the keys and values of configuration options found in the 
configuration section named [authz-AUTHORIZERNAME] (where AUTHORIZERNAME is 
the name of the Authorizer module, in this case, "forbiddenre".  So that 
code, plus a configuration like this:

     [general]
     ...
     authorizer = forbiddenre
     ...

     [authz-forbiddenre]
     forbidden = (some regexps)

works exactly as expected.  It doesn't matter than the configuration option 
name (forbidden) doesn't match the name of the Authorizer (forbiddenre), or 
indeed that it *does* match the name of a configuration option associated 
with a different Authorizer (forbidden).

Of course, yesterday, I changed this code so that now you need:

     [authz-forbiddenre]
     forbiddenre = (some regexps)

in hopes that this will clear up user confusion which clearly already 
exists. :-)

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH4Uc8okEGqRcG/W4RAsV6AJ0WzPlJGc3l2nqQx7mkVYygAACPNwCfXFJl
cA+6AtYzTFliie6D+emjNig=
=ieh5
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.