• Remember Mailing List

  • custom cmfmember type migration failing

    from "Darcy Clark" on 2008-02-14 02:46
    Plone 2.1.4 migrating to Plone 2.5.4
    Zope 2.9.8
    Python 2.4.4
    
    remember 1.0b1
    membrane 1.0
    contentmigration 1.5a1 svn/unreleased
    
    I've been trying to migrate a Plone 2.1.4 with a custom CMFMember Member
    type to Plone 2.5.4. I basically followed the instructions outlined in
    remember/cmfmember/README.txt. The typical error that I'm getting is
    triggered by line 75 below in contentmigration/common.py:
    
    66    # we have to do it all manually :(
    67    p = container.manage_addProduct[fti.product]
    68    m = getattr(p, fti.factory, None)
    69    if m is None:
    70        raise ValueError, ('Product factory for %s was invalid' %
    71                           fti.getId())
    72
    73    # construct the object
    74    m(id, *args, **kw)
    75    ob = container._getOb( id )
    
    Basically the new Member is created by line 74; line 75 tries to get the new
    object, which is where it fails with:
    
    ".....\Products\contentmigration\common.py", line 75, in _createObjectByType
    ob = container._getOb( id ) AttributeError: _getOb
    
    Getting in and debugging I've determined that the new Member instance isn't
    created in the container (portal.portal_memberdata) but rather in the portal
    root. Hence container._getOb( id ) fails.
    
    I sense that something isn't right with the "container" object but typing
    the following at the PDB prompt returns what appears to be the correct
    object:
    
    -> ob = container._getOb( id )
    (Pdb) container
    <MemberDataTool at /vhosts/permaforest/portal_memberdata>
    
    My Plone-fu is weak after many hours bashing away on this with little
    progress - is there anything obvious that I've done wrong here ?
    
    Darcy
    
    
    Thread Outline:
  • Re: custom cmfmember type migration failing

    from ra on 2008-02-14 14:56
    Darcy Clark wrote:
    > Plone 2.1.4 migrating to Plone 2.5.4
    > Zope 2.9.8
    > Python 2.4.4
    > 
    > remember 1.0b1
    > membrane 1.0
    > contentmigration 1.5a1 svn/unreleased
    > 
    > I've been trying to migrate a Plone 2.1.4 with a custom CMFMember Member 
    > type to Plone 2.5.4. I basically followed the instructions outlined in 
    > remember/cmfmember/README.txt. The typical error that I'm getting is 
    > triggered by line 75 below in contentmigration/common.py:
    > 
    > 66    # we have to do it all manually :(
    > 67    p = container.manage_addProduct[fti.product]
    > 68    m = getattr(p, fti.factory, None)
    > 69    if m is None:
    > 70        raise ValueError, ('Product factory for %s was invalid' %
    > 71                           fti.getId())
    > 72
    > 73    # construct the object
    > 74    m(id, *args, **kw)
    > 75    ob = container._getOb( id )
    > 
    > Basically the new Member is created by line 74; line 75 tries to get the 
    > new object, which is where it fails with:
    > 
    > ".....\Products\contentmigration\common.py", line 75, in 
    > _createObjectByType ob = container._getOb( id ) AttributeError: _getOb
    > 
    > Getting in and debugging I've determined that the new Member instance 
    > isn't created in the container (portal.portal_memberdata) but rather in 
    > the portal root. Hence container._getOb( id ) fails.
    
    this is quite strange, though... the error you're getting is an 
    AttributeError, which implies that 'container' doesn't have the _getOb method. 
      since _getOb is present on pretty much every Zope folderish type, it's an 
    indication that container is very much not what we're expecting it to be.
    
    > I sense that something isn't right with the "container" object but 
    > typing the following at the PDB prompt returns what appears to be the 
    > correct object:
    > 
    > -> ob = container._getOb( id )
    > (Pdb) container
    > <MemberDataTool at /vhosts/permaforest/portal_memberdata>
    
    wait a minute.  you've got a MemberDataTool.  with both CMFMember and 
    remember, this should be a MemberDataContainer.  the CMFMember -> remember 
    migration will only work on a site that has CMFMember installed.  are you sure 
    CMFMember is installed in the site that you're migrating?
    
    anyway, this explains why your members are ending up at the portal root... 
    portal_memberdata isn't a container at all, so acquisition is kicking in and 
    methods are being run on the parent container, i.e. the portal root object.
    
    not sure what's going on, but hopefully this will provide you with some clues.
    
    -r
    
    • Re: custom cmfmember type migration failing

      from "Darcy Clark" on 2008-02-14 19:18
      Rob,
      
      thanks for your reply - you gave me useful clues which I think have yielded
      some progress. I think there might be a bug in remember/cmfmember/monkey.py
      in the migrateMemberDataTool:
      
      129    # need to instantiate a default MemberDataTool since changes to
      130    # GenericSetup mean the membrane profile is no longer doing so,
      131    # but it will fail if there isn't one
      132    if portal._getOb('portal_memberdata', None) is None:
      133        mdtool = MemberDataTool()
      134        portal._setObject('portal_memberdata', mdtool)
      
      where MemberDataTool() is imported as below:
      
      17     from Products.PlonePAS.tools.memberdata import MemberDataTool
      
      I've changed this to:
      
      129    # need to instantiate a default MemberDataTool since changes to
      130    # GenericSetup mean the membrane profile is no longer doing so,
      131    # but it will fail if there isn't one
      132    if portal._getOb('portal_memberdata', None) is None:
      133        mdtool = MemberDataContainer()
      134        portal._setObject('portal_memberdata', mdtool)
      
      where MemberDataContainer() is imported as below:
      
      17    from Products.remember.tools.memberdata import MemberDataContainer
      
      After this tweak all of my custom CMFMember intances seems to be migrated
      properly now. Apart from having to upgrade PluggableAuthService to fix the
      "ValueError: Property portrait: unknown type" (as per
      http://plone.org/products/remember/issues/32) all is fine now.
      
      thanks for your help!
      
      Darcy
      
      On 15/02/2008, Rob Miller <robm@...> wrote:
      >
      > Darcy Clark wrote:
      > > Plone 2.1.4 migrating to Plone 2.5.4
      > > Zope 2.9.8
      > > Python 2.4.4
      > >
      > > remember 1.0b1
      > > membrane 1.0
      > > contentmigration 1.5a1 svn/unreleased
      > >
      > > I've been trying to migrate a Plone 2.1.4 with a custom CMFMember Member
      > > type to Plone 2.5.4. I basically followed the instructions outlined in
      > > remember/cmfmember/README.txt. The typical error that I'm getting is
      > > triggered by line 75 below in contentmigration/common.py:
      > >
      > > 66    # we have to do it all manually :(
      > > 67    p = container.manage_addProduct[fti.product]
      > > 68    m = getattr(p, fti.factory, None)
      > > 69    if m is None:
      > > 70        raise ValueError, ('Product factory for %s was invalid' %
      > > 71                           fti.getId())
      > > 72
      > > 73    # construct the object
      > > 74    m(id, *args, **kw)
      > > 75    ob = container._getOb( id )
      > >
      > > Basically the new Member is created by line 74; line 75 tries to get the
      > > new object, which is where it fails with:
      > >
      > > ".....\Products\contentmigration\common.py", line 75, in
      > > _createObjectByType ob = container._getOb( id ) AttributeError: _getOb
      > >
      > > Getting in and debugging I've determined that the new Member instance
      > > isn't created in the container (portal.portal_memberdata) but rather in
      > > the portal root. Hence container._getOb( id ) fails.
      >
      >
      > this is quite strange, though... the error you're getting is an
      > AttributeError, which implies that 'container' doesn't have the _getOb
      > method.
      >   since _getOb is present on pretty much every Zope folderish type, it's
      > an
      > indication that container is very much not what we're expecting it to be.
      >
      >
      > > I sense that something isn't right with the "container" object but
      > > typing the following at the PDB prompt returns what appears to be the
      > > correct object:
      > >
      > > -> ob = container._getOb( id )
      > > (Pdb) container
      > > <MemberDataTool at /vhosts/permaforest/portal_memberdata>
      >
      >
      > wait a minute.  you've got a MemberDataTool.  with both CMFMember and
      > remember, this should be a MemberDataContainer.  the CMFMember -> remember
      > migration will only work on a site that has CMFMember installed.  are you
      > sure
      > CMFMember is installed in the site that you're migrating?
      >
      > anyway, this explains why your members are ending up at the portal root...
      > portal_memberdata isn't a container at all, so acquisition is kicking in
      > and
      > methods are being run on the parent container, i.e. the portal root
      > object.
      >
      > not sure what's going on, but hopefully this will provide you with some
      > clues.
      >
      > -r
      >
      >
      >
      > --
      > Archive:
      > http://www.openplans.org/projects/remember/lists/remember/archive/2008/02/1203018978384
      > To unsubscribe send an email with subject unsubscribe to
      > remember@....  Please contact
      > remember-manager@... for questions.
      >
      >
      
      
      -- 
      Darcy Clark
      http://CMSArchitects.com
      Customized Content Management Solutions
      ph:    +61 7 3342 1072
      mob: +61 4 3046 7133
      Brisbane, QLD, Australia (GMT+10)
      
      
      • Re: custom cmfmember type migration failing

        from ra on 2008-02-14 19:31
        Darcy Clark wrote:
        > Rob,
        > 
        > thanks for your reply - you gave me useful clues which I think have 
        > yielded some progress. I think there might be a bug in 
        > remember/cmfmember/monkey.py in the migrateMemberDataTool:
        > 
        > 129    # need to instantiate a default MemberDataTool since changes to
        > 130    # GenericSetup mean the membrane profile is no longer doing so,
        > 131    # but it will fail if there isn't one
        > 132    if portal._getOb('portal_memberdata', None) is None:
        > 133        mdtool = MemberDataTool()
        > 134        portal._setObject('portal_memberdata', mdtool)
        > 
        > where MemberDataTool() is imported as below:
        > 
        > 17     from Products.PlonePAS.tools.memberdata import MemberDataTool
        > 
        > I've changed this to:
        > 
        > 129    # need to instantiate a default MemberDataTool since changes to
        > 130    # GenericSetup mean the membrane profile is no longer doing so,
        > 131    # but it will fail if there isn't one
        > 132    if portal._getOb('portal_memberdata', None) is None:
        > 133        mdtool = MemberDataContainer()
        > 134        portal._setObject('portal_memberdata', mdtool)
        > 
        > where MemberDataContainer() is imported as below:
        > 
        > 17    from Products.remember.tools.memberdata import MemberDataContainer
        > 
        > After this tweak all of my custom CMFMember intances seems to be 
        > migrated properly now. Apart from having to upgrade PluggableAuthService 
        > to fix the "ValueError: Property portrait: unknown type" (as per 
        > http://plone.org/products/remember/issues/32) all is fine now.
        > 
        > thanks for your help!
        
        no prob.  do you have collective commit access so you can commit the fix to 
        the remember trunk?
        
        -r