I've seen repoze.who plugins use functions to validate their instantiation, 
and I wonder why this code is not included in the constructor?

For example, in repoze.who.plugins.form, see FormPlugin and make_plugin().

I wrote an LDAP IAuthenticator this way, but I'm now in a situation where it 
could better if this validation code was in the constructor:

I've written a FormPlugin-based plugin (UidLDAPFormPlugin), which makes this 
plugin support the LDAP authenticator by adding the Distinguished Name (DN) to 
the identity dict. Because the only modification over the FormPlugin plugin is 
that the identity dict now included the 'dn' key, I'd like to re-use the code 
of make_plugin() to instantiate UidLDAPFormPlugin, without copying its code 
and add the extra parameter required by UidLDAPFormPlugin.

Here you will find the code:

Would I get side effects if I move validation code to the constructor?

Thanks in advance.
Gustavo Narea.

Get rid of unethical constraints! Switch to Freedomware:

Repoze-dev mailing list

Reply via email to