[Erp5-report] r42975 nicolas.dumazet - /erp5/trunk/products/ERP5/ERP5Site.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 3 13:32:06 CET 2011


Author: nicolas.dumazet
Date: Thu Feb  3 13:32:06 2011
New Revision: 42975

URL: http://svn.erp5.org?rev=42975&view=rev
Log:
Allow calling this method from the web

Modified:
    erp5/trunk/products/ERP5/ERP5Site.py

Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=42975&r1=42974&r2=42975&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Thu Feb  3 13:32:06 2011
@@ -1410,7 +1410,7 @@ class ERP5Site(FolderMixIn, CMFSite, Cac
       self.erp5_site_global_id = global_id
 
   security.declareProtected(Permissions.ManagePortal, 'migrateToPortalTypeClass')
-  def migrateToPortalTypeClass(self):
+  def migrateToPortalTypeClass(self, REQUEST=None):
     """Compatibility code that allows migrating a site to portal type classes.
     
     We consider that a Site is migrated if its Types Tool is migrated
@@ -1421,6 +1421,11 @@ class ERP5Site(FolderMixIn, CMFSite, Cac
       return
     if types_tool.__class__.__module__ == 'erp5.portal_type':
       # nothing to do, already migrated
+      if REQUEST is not None:
+        return REQUEST.RESPONSE.redirect(
+          '%s?portal_status_message=' \
+          'Nothing to do, already migrated.' % \
+          self.absolute_url())
       return
 
     # note that the site itself is not migrated (ERP5Site is not a portal type)
@@ -1437,6 +1442,12 @@ class ERP5Site(FolderMixIn, CMFSite, Cac
         continue
       method()
 
+    if REQUEST is not None:
+      return REQUEST.RESPONSE.redirect(
+        '%s?portal_status_message=' \
+        'Successfully migrated tools and types to portal type classes.' % \
+        self.absolute_url())
+
 Globals.InitializeClass(ERP5Site)
 
 def getBootstrapDirectory():



More information about the Erp5-report mailing list