[Erp5-report] r12366 - /erp5/trunk/products/ERP5/Tool/ContributionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 25 15:26:43 CET 2007


Author: bartek
Date: Thu Jan 25 15:26:37 2007
New Revision: 12366

URL: http://svn.erp5.org?rev=12366&view=rev
Log:
fixed bugs in type detection; removed setting source_reference (it is done in discoverMetadata)

Modified:
    erp5/trunk/products/ERP5/Tool/ContributionTool.py

Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=12366&r1=12365&r2=12366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py Thu Jan 25 15:26:37 2007
@@ -105,8 +105,10 @@
         if len(portal_type_list)>1 and portal_type not in portal_type_list:
           raise TypeError('%s not in the list of %s' % (portal_type, str(portal_type_list)))
         return portal_type
-      # if not found but the candidate list is there, return the first
-      return portal_type_list[0]
+      else:
+        # if not found but the candidate list is there, return the first
+        if len(portal_type_list)>0:
+          return portal_type_list[0]
 
     if portal_type is None:
       # We can not do anything anymore
@@ -146,8 +148,6 @@
     file = kw.get('file', None)
     if file is not None:
       file_name = file.filename
-      # we store it as source_reference
-      kw['source_reference'] = file_name
     else:
       file_name = None
 
@@ -160,7 +160,6 @@
       # NOTE: we use the module ID generator rather than the provided ID
       document = module.newContent(portal_type=portal_type, **kw)
       if discover_metadata: document.discoverMetadata(file_name=file_name, user_login=user_login)
-      pdb.set_trace()
       return document
 
     # From here, there is no hope unless a file was provided    
@@ -222,7 +221,7 @@
     property_dict = {}
     rx_src = self.portal_preferences.getPreferredDocumentFileNameRegularExpression()
     if rx_src:
-      rx_parse = re.compile()
+      rx_parse = re.compile(rx_src)
       if rx_parse is not None:
         try:
           property_dict = rx_parse.match(file_name).groupdict()




More information about the Erp5-report mailing list