Changeset 1325


Ignore:
Timestamp:
02/01/07 16:46:13 (13 years ago)
Author:
pjotr
Message:

References #1105, must be nice but try to give it a test anyway

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Extensions/Install.py

    r1316 r1325  
    736736                    print >>out, 'Section %s is already large folder' % folder_old.getId() 
    737737            print >>out, "Migration from 1.6 complete" 
     738 
     739        if old<='1.6.1': 
     740            print >>out, "Starting migration from 1.6.1" 
     741            print >>out, "Owners for collections and stories" 
     742            # Create collections and stories folders for those users who do not have then yet 
     743            for member in self.community.objectValues('MemberFolder'): 
     744                if not hasattr(member.aq_base, 'collections'): 
     745                    member.invokeFactory('CollectionsFolder', id='collections') 
     746                if not hasattr(member.aq_base, 'stories'): 
     747                    member.invokeFactory('StoryFolder', id='stories') 
     748            # Check if collections and stories folders have correct Owner, if not then just change the owner to the right one 
     749            for member in self.community.objectValues('MemberFolder'): 
     750                member_id = member.users_with_local_role('Owner') 
     751                member_as_owner = member.getId() 
     752                if member_id != member.collections.users_with_local_role('Owner'): 
     753                    to_delete_owner_collections = str(member.collections.getOwner()) 
     754                    member.collections.changeOwnership(getattr(member.collections,member_as_owner)) 
     755                    member.collections.manage_delLocalRoles([to_delete_owner_collections,]) 
     756                    member.collections.manage_addLocalRoles(member_as_owner, ['Owner',]) 
     757                if member_id != member.stories.users_with_local_role('Owner'): 
     758                    to_delete_owner_stories = str(member.stories.getOwner()) 
     759                    member.stories.changeOwnership(getattr(member.stories,member_as_owner)) 
     760                    member.stories.manage_delLocalRoles([to_delete_owner_collections,]) 
     761                    member.stories.manage_addLocalRoles(member_as_owner, ['Owner',]) 
     762            print >>out, "Migration from 1.6.1 complete" 
     763                 
    738764             
    739765 
  • trunk/version.txt

    r1316 r1325  
    1 1.6.1 
     11.6.2 
Note: See TracChangeset for help on using the changeset viewer.