[Erp5-report] r10082 - in /erp5/trunk/products/ERP5Type: Tool/ dtml/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Sep 18 12:51:21 CEST 2006


Author: jerome
Date: Mon Sep 18 12:51:19 2006
New Revision: 10082

URL: http://svn.erp5.org?rev=10082&view=rev
Log:

make .cvsignore generation optional when generating a product


Modified:
    erp5/trunk/products/ERP5Type/Tool/ClassTool.py
    erp5/trunk/products/ERP5Type/dtml/viewProductGeneration.dtml

Modified: erp5/trunk/products/ERP5Type/Tool/ClassTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/ClassTool.py?rev=10082&r1=10081&r2=10082&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/ClassTool.py (original)
+++ erp5/trunk/products/ERP5Type/Tool/ClassTool.py Mon Sep 18 12:51:19 2006
@@ -28,6 +28,7 @@
 
 from Products.CMFCore.utils import UniqueObject
 
+from zExceptions import BadRequest
 from Acquisition import Implicit
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass, DTMLFile
@@ -610,9 +611,18 @@
       security.declareProtected( Permissions.ManageExtensions, 'generateProduct' )
       def generateProduct(self, product_id,
                           document_id_list=(), property_sheet_id_list=(), constraint_id_list=(),
-                          extension_id_list=(), test_id_list=(), REQUEST=None):
+                          extension_id_list=(), test_id_list=(),
+                          generate_cvsignore=0, REQUEST=None):
         """Generate a Product
         """
+        if not product_id:
+          message = 'Product Name must be specified'
+          if REQUEST is not None:
+            return REQUEST.RESPONSE.redirect(
+                    '%s/manage_viewProductGeneration?manage_tabs_message=%s' %
+                    (self.absolute_url(), message.replace(' ', '+')))
+          raise BadRequest(message)
+        
         # Ensure that Products exists.
         product_path = os.path.join(getConfiguration().instancehome, 'Products')
         if not os.path.exists(product_path):
@@ -650,13 +660,14 @@
           f.close()
 
         # Make .cvsignore for convenience.
-        cvsignore = os.path.join(base_path, '.cvsignore')
-        if not os.path.exists(cvsignore):
-          f = open(cvsignore, 'w')
-          try:
-            f.write('*.pyc' + os.linesep)
-          finally:
-            f.close()
+        if generate_cvsignore:
+          cvsignore = os.path.join(base_path, '.cvsignore')
+          if not os.path.exists(cvsignore):
+            f = open(cvsignore, 'w')
+            try:
+              f.write('*.pyc' + os.linesep)
+            finally:
+              f.close()
 
         # Create an init file for this Product.
         init = os.path.join(base_path, '__init__.py')
@@ -746,7 +757,7 @@
               f.close()
 
         if REQUEST is not None:
-          REQUEST.RESPONSE.redirect('%s/manage_viewProductGeneration?message=New+Product+Saved+In+%s' % (self.absolute_url(), base_path))
+          REQUEST.RESPONSE.redirect('%s/manage_viewProductGeneration?manage_tabs_message=New+Product+Saved+In+%s' % (self.absolute_url(), base_path))
 
       security.declareProtected( Permissions.ManagePortal,
                                  'asDocumentationHelper')

Modified: erp5/trunk/products/ERP5Type/dtml/viewProductGeneration.dtml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dtml/viewProductGeneration.dtml?rev=10082&r1=10081&r2=10082&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dtml/viewProductGeneration.dtml (original)
+++ erp5/trunk/products/ERP5Type/dtml/viewProductGeneration.dtml Mon Sep 18 12:51:19 2006
@@ -25,7 +25,18 @@
     <input type="text" name="product_id" size="40" value="" />
     </td>
   </tr>
-
+  
+  <tr>
+    <td align="left" valign="top">
+    <div class="form-label">
+    Generate .cvsignore files ?
+    </div>
+    </td>
+    <td align="left" valign="top">
+      <input type="checkbox" name="generate_cvsignore" />
+    </td>
+  </tr>
+  
   <tr>
     <td align="left" valign="top">
     <div class="form-label">




More information about the Erp5-report mailing list