Back to index

plone3  3.1.7
Functions | Variables
GroupUserFolder.Extensions.Install Namespace Reference

Functions

def install_plone
def install_subskin
def walk
def migrate_user_folder
def migrate_plone_site_to_gruf
def install
 walk(out, plonesite, migrate_user_folder)

Variables

string __version__ = "$Revision: $"
 GroupUserFolder Copyright (C)2006 Ingeniweb.
string __docformat__ = 'restructuredtext'
string SKIN_NAME = "gruf"
tuple _globals = globals()

Function Documentation

walk(out, plonesite, migrate_user_folder)

Definition at line 119 of file Install.py.

00119 
00120 def install(self):
00121     out = StringIO()
00122     print >>out, "Installing GroupUserFolder"
00123     install_subskin(self, out)
00124     install_plone(self, out)
00125     migrate_plone_site_to_gruf(self, out)
00126     print >>out, "Done."
00127     return out.getvalue()

Here is the call graph for this function:

Definition at line 38 of file Install.py.

00038 
00039 def install_plone(self, out):
00040     pass

Here is the caller graph for this function:

def GroupUserFolder.Extensions.Install.install_subskin (   self,
  out,
  skin_name = SKIN_NAME,
  globals = groupuserfolder_globals 
)

Definition at line 41 of file Install.py.

00041 
00042 def install_subskin(self, out, skin_name=SKIN_NAME, globals=groupuserfolder_globals):
00043     print >>out, "  Installing subskin."
00044     skinstool=getToolByName(self, 'portal_skins')
00045     if skin_name not in skinstool.objectIds():
00046         print >>out, "    Adding directory view for GRUF"
00047         addDirectoryViews(skinstool, 'skins', globals)
00048 
00049     for skinName in skinstool.getSkinSelections():
00050         path = skinstool.getSkinPath(skinName)
00051         path = [i.strip() for i in  path.split(',')]
00052         try:
00053             if skin_name not in path:
00054                 path.insert(path.index('custom') +1, skin_name)
00055         except ValueError:
00056             if skin_name not in path:
00057                 path.append(skin_name)
00058 
00059         path = ','.join(path)
00060         skinstool.addSkinSelection( skinName, path)
00061     print >>out, "  Done installing subskin."

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 103 of file Install.py.

00103 
00104 def migrate_plone_site_to_gruf(self, out = None):
00105     if out is None:
00106         out = StringIO()
00107     print >>out, "  Attempting to migrate UserFolders to GroupUserFolders..."
00108     urltool=getToolByName(self, 'portal_url')
00109     plonesite = urltool.getPortalObject()
00110     ## We disable the 'walk' operation because if the acl_users object is deep inside
00111     ## the Plone site, that is a real problem. Furthermore, that may be because
00112     ## we're already digging an GRUF and have the risk to update a GRUF/User/acl_users
    ## object !

Here is the call graph for this function:

Here is the caller graph for this function:

Move a user folder into a temporary folder, create a GroupUserFolder,
and then move the old user folder into the Users portion of the GRUF.
NOTE: You cant copy/paste between CMF and Zope folder.  *sigh*

Definition at line 69 of file Install.py.

00069 
00070 def migrate_user_folder(obj, out, ):
00071     """
00072     Move a user folder into a temporary folder, create a GroupUserFolder,
00073     and then move the old user folder into the Users portion of the GRUF.
00074     NOTE: You cant copy/paste between CMF and Zope folder.  *sigh*
00075     """
00076     id = obj.getId()
00077     if id == 'acl_users':
00078         if obj.__class__.__name__ == "GroupUserFolder":
00079             # Avoid already-created GRUFs
00080             print >>out, "    Do NOT migrate acl_users at %s, as it is already a GroupUserFolder" % ('/'.join( obj.getPhysicalPath() ), )
00081             return out.getvalue()
00082 
00083         print >>out, "    Migrating acl_users folder at %s to a GroupUserFolder" % ('/'.join( obj.getPhysicalPath() ), )
00084 
00085         container = obj.aq_parent
00086 
00087         # Instead of using Copy/Paste we hold a reference to the acl_users
00088         # and use that reference instead of physically moving objects in ZODB
00089         tmp_users=container._getOb('acl_users')
00090         tmp_allow=container.__allow_groups__
00091 
00092         del container.__allow_groups__
00093         if 'acl_users' in container.objectIds():
00094             container.manage_delObjects('acl_users')
00095 
00096         container.manage_addProduct['GroupUserFolder'].manage_addGroupUserFolder()
00097         container.acl_users.Users.manage_delObjects( 'acl_users' )
00098         container.acl_users.Users._setObject('acl_users', aq_base(tmp_users))
00099         container.__allow_groups__ = aq_base(getattr(container,'acl_users'))
00100 
00101     return out.getvalue()
00102 

Here is the call graph for this function:

Here is the caller graph for this function:

def GroupUserFolder.Extensions.Install.walk (   out,
  obj,
  operation 
)

Definition at line 62 of file Install.py.

00062 
00063 def walk(out, obj, operation):
00064     if obj.isPrincipiaFolderish:
00065         for content in obj.objectValues():
00066             walk(out, content, operation)
00067     operation(out, obj)
00068 

Here is the caller graph for this function:


Variable Documentation

Definition at line 24 of file Install.py.

GroupUserFolder Copyright (C)2006 Ingeniweb.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Definition at line 21 of file Install.py.

Definition at line 36 of file Install.py.

Definition at line 35 of file Install.py.