[Zope-CMF] Small change on MemberdataTool

Tres Seaver tseaver@zope.com
19 May 2003 09:46:31 -0400

On Sun, 2003-05-18 at 08:56, Sidnei da Silva wrote:

> I would like to make a small change on MemberdataTool, so it does get
> the wrapper class from a property on the tool, instead of hardcoding
> it. Otherwise, you have to override a full method when subclassing to
> make something useful out of it.
> The change would not affect behavior, and I think its a nice
> improvement (and I need it for NZO :P), so if its ok, I would make the
> change on 1_3-branch, 1_4-branch and HEAD.

Does NZO require that this be on the 1.3 branch?  This is really a new
feature;  I can see sneaking it into 1.4 (it should be low risk), but I
have no plans at the moment to release a 1.3.2, and would really like to
keep the change set on that branch to essential bugfixes (so that making
a 1.3.2 release requires the least amount of testing).

> Im proposing to change MemberDataTool.wrapUser(), around line 164 (on
> my 1_3-branch checkout) to get the class from a property of the
> MemberDataTool class.
> -                m = MemberData(base, id)
> +                m = self._data_wrapper_class(base, id)

I'd rather that it call a method to get the wrapper class:

  def _getDataWrapperClass( self ):
      return self._data_wrapper_class

That way, somebody could write a more clever tool (e.g., one which had
the "dotted name" of the class as a string property), without requiring
that they keep a special attribute in sync.

Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com