Commit bac66c42 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Fix except with no name.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4150 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7320b4e3
...@@ -88,7 +88,7 @@ class ActiveProcess(Base): ...@@ -88,7 +88,7 @@ class ActiveProcess(Base):
""" """
try: try:
my_id = int(self.getLastId()) my_id = int(self.getLastId())
except: except TypeError:
my_id = 1 my_id = 1
while self.result_list.has_key(my_id): while self.result_list.has_key(my_id):
my_id = my_id + 1 my_id = my_id + 1
......
...@@ -31,6 +31,7 @@ from Acquisition import aq_base ...@@ -31,6 +31,7 @@ from Acquisition import aq_base
from DateTime import DateTime from DateTime import DateTime
from Products.CMFActivity.ActivityTool import Message from Products.CMFActivity.ActivityTool import Message
from zLOG import LOG from zLOG import LOG
from ZODB.POSException import ConflictError
# Error values for message validation # Error values for message validation
EXCEPTION = -1 EXCEPTION = -1
...@@ -151,6 +152,8 @@ class Queue: ...@@ -151,6 +152,8 @@ class Queue:
for k, v in kw.items(): for k, v in kw.items():
if activity_tool.validateOrder(message, k, v): if activity_tool.validateOrder(message, k, v):
return INVALID_ORDER return INVALID_ORDER
except ConflictError:
raise
except: except:
LOG('WARNING ActivityTool', 0, LOG('WARNING ActivityTool', 0,
'Validation of Object %s raised exception' % '/'.join(message.object_path), 'Validation of Object %s raised exception' % '/'.join(message.object_path),
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
from Products.CMFCategory.Filter import Filter from Products.CMFCategory.Filter import Filter
from ZODB.POSException import ConflictError
from zLOG import LOG from zLOG import LOG
class Renderer(Filter): class Renderer(Filter):
...@@ -184,6 +184,8 @@ class Renderer(Filter): ...@@ -184,6 +184,8 @@ class Renderer(Filter):
elif self.display_id is not None: elif self.display_id is not None:
try: try:
label = value.getProperty(self.display_id) label = value.getProperty(self.display_id)
except ConflictError:
raise
except: except:
LOG('WARNING: Renderer', 0, LOG('WARNING: Renderer', 0,
'Unable to call %s on %s' % (self.display_id, value.getRelativeUrl())) 'Unable to call %s on %s' % (self.display_id, value.getRelativeUrl()))
......
...@@ -440,7 +440,7 @@ An ERP5 Rule...""" ...@@ -440,7 +440,7 @@ An ERP5 Rule..."""
# We can now apply the calculated movements on the applied rule # We can now apply the calculated movements on the applied rule
try: try:
new_period = max(aggregated_period_dict.keys()) + 1 new_period = max(aggregated_period_dict.keys()) + 1
except: except TypeError:
new_period = 0 new_period = 0
for (c_period_number, calculated_dict) in calculated_period_dict.items(): for (c_period_number, calculated_dict) in calculated_period_dict.items():
# First, look for a potential found match # First, look for a potential found match
...@@ -555,7 +555,7 @@ An ERP5 Rule...""" ...@@ -555,7 +555,7 @@ An ERP5 Rule..."""
# the types which have not been matched later # the types which have not been matched later
try: try:
del aggregated_movement_dict[type] del aggregated_movement_dict[type]
except: except KeyError:
pass pass
movements_created = setRemainingAggregatedMovementsToZero(aggregated_movement_dict = aggregated_movement_dict, movements_created = setRemainingAggregatedMovementsToZero(aggregated_movement_dict = aggregated_movement_dict,
......
...@@ -594,7 +594,7 @@ identify a bank account.""" ...@@ -594,7 +594,7 @@ identify a bank account."""
try: try:
priced_quantity = float(priced_quantity) priced_quantity = float(priced_quantity)
if priced_quantity == 0.0: priced_quantity = 1.0 if priced_quantity == 0.0: priced_quantity = 1.0
except: except TypeError:
priced_quantity = 1.0 priced_quantity = 1.0
error_list += ["Priced Quantity could not be converted for resource %s" % resource_id] error_list += ["Priced Quantity could not be converted for resource %s" % resource_id]
# source_base_price is the default base price. # source_base_price is the default base price.
...@@ -608,14 +608,14 @@ identify a bank account.""" ...@@ -608,14 +608,14 @@ identify a bank account."""
base_price = resource.getBasePrice() base_price = resource.getBasePrice()
try: try:
base_price = float(base_price) base_price = float(base_price)
except: except TypeError:
base_price = 0.0 base_price = 0.0
error_list += ["Default base price could not be converted for resource %s" % resource_id] error_list += ["Default base price could not be converted for resource %s" % resource_id]
if resource.hasSourceBasePrice(): if resource.hasSourceBasePrice():
source_base_price = resource.getSourceBasePrice() source_base_price = resource.getSourceBasePrice()
try: try:
source_base_price = float(source_base_price) source_base_price = float(source_base_price)
except: except TypeError:
source_base_price = 0.0 source_base_price = 0.0
error_list += ["Source base price could not be converted for resource %s" % resource_id] error_list += ["Source base price could not be converted for resource %s" % resource_id]
resource_quantity_unit = resource.getDefaultQuantityUnit() resource_quantity_unit = resource.getDefaultQuantityUnit()
...@@ -644,7 +644,7 @@ identify a bank account.""" ...@@ -644,7 +644,7 @@ identify a bank account."""
new_base_price = resource_variation.getBasePrice() new_base_price = resource_variation.getBasePrice()
try: try:
new_base_price = float(new_base_price) new_base_price = float(new_base_price)
except: except TypeError:
new_base_price = 0.0 new_base_price = 0.0
error_list += ["Default base price could not be converted for resource variation %s" error_list += ["Default base price could not be converted for resource variation %s"
% resource_variation.id] % resource_variation.id]
...@@ -655,7 +655,7 @@ identify a bank account.""" ...@@ -655,7 +655,7 @@ identify a bank account."""
if resource_variation.hasSourceBasePrice(): if resource_variation.hasSourceBasePrice():
try: try:
new_source_base_price = float(new_source_base_price) new_source_base_price = float(new_source_base_price)
except: except TypeError:
new_source_base_price = 0.0 new_source_base_price = 0.0
error_list += ["Source base price could not be converted for resource variation %s" error_list += ["Source base price could not be converted for resource variation %s"
% resource_variation.id] % resource_variation.id]
...@@ -703,7 +703,7 @@ identify a bank account.""" ...@@ -703,7 +703,7 @@ identify a bank account."""
quantity = float(mapped_value.quantity) quantity = float(mapped_value.quantity)
is_variated_quantity = 1 # The variated quantity is 1 is_variated_quantity = 1 # The variated quantity is 1
# when the quantity is defined by a variation matrix # when the quantity is defined by a variation matrix
except: except TypeError:
error_list += ["Quantity defined by %s is not a float" % mapped_value.id] error_list += ["Quantity defined by %s is not a float" % mapped_value.id]
# Update categories defined by the mapped value # Update categories defined by the mapped value
base_category_list = mapped_value.getMappedValueBaseCategoryList() base_category_list = mapped_value.getMappedValueBaseCategoryList()
...@@ -717,7 +717,7 @@ identify a bank account.""" ...@@ -717,7 +717,7 @@ identify a bank account."""
new_base_price = resource_variation.getBasePrice() new_base_price = resource_variation.getBasePrice()
try: try:
new_base_price = float(new_base_price) new_base_price = float(new_base_price)
except: except TypeError:
new_base_price = 0.0 new_base_price = 0.0
error_list += \ error_list += \
["Default base price could not be converted for resource variation %s" ["Default base price could not be converted for resource variation %s"
...@@ -729,7 +729,7 @@ identify a bank account.""" ...@@ -729,7 +729,7 @@ identify a bank account."""
new_source_base_price = resource_variation.getSourceBasePrice() new_source_base_price = resource_variation.getSourceBasePrice()
try: try:
new_source_base_price = float(new_source_base_price) new_source_base_price = float(new_source_base_price)
except: except TypeError:
new_source_base_price = 0.0 new_source_base_price = 0.0
error_list += \ error_list += \
["Source base price could not be converted for resource variation %s" ["Source base price could not be converted for resource variation %s"
...@@ -742,7 +742,7 @@ identify a bank account.""" ...@@ -742,7 +742,7 @@ identify a bank account."""
resource_quantity_unit) resource_quantity_unit)
try: try:
converted_quantity = float(converted_quantity) converted_quantity = float(converted_quantity)
except: except TypeError:
converted_quantity = 0.0 converted_quantity = 0.0
error_list += ["Quantity could not be converted for resource %s" % resource.id] error_list += ["Quantity could not be converted for resource %s" % resource.id]
# Convert price to unit price # Convert price to unit price
......
...@@ -1373,12 +1373,7 @@ class ModuleTemplateItem(BaseTemplateItem): ...@@ -1373,12 +1373,7 @@ class ModuleTemplateItem(BaseTemplateItem):
module.setTitle(str(mapping['title'])) module.setTitle(str(mapping['title']))
for name,role_list in list(mapping['permission_list']): for name,role_list in list(mapping['permission_list']):
acquire = (type(role_list) == type([])) acquire = (type(role_list) == type([]))
try:
module.manage_permission(name, roles=role_list, acquire=acquire) module.manage_permission(name, roles=role_list, acquire=acquire)
except:
# Normally, an exception is raised when you don't install any Product which
# has been in use when this business template is created.
pass
def _importFile(self, file_name, file): def _importFile(self, file_name, file):
dict = {} dict = {}
......
...@@ -120,7 +120,7 @@ class DeliveryCell(MappedValue, Movement): ...@@ -120,7 +120,7 @@ class DeliveryCell(MappedValue, Movement):
# Standard accessor # Standard accessor
try: try:
result = Movement.getProperty(self, key, d=d) result = Movement.getProperty(self, key, d=d)
except: except AttributeError:
result = None result = None
return result return result
...@@ -140,7 +140,7 @@ class DeliveryCell(MappedValue, Movement): ...@@ -140,7 +140,7 @@ class DeliveryCell(MappedValue, Movement):
try: try:
price = float(price) price = float(price)
quantity = float(quantity) quantity = float(quantity)
except: except TypeError:
price = 0.0 price = 0.0
quantity = 0.0 quantity = 0.0
total_quantity += quantity total_quantity += quantity
...@@ -194,7 +194,7 @@ class DeliveryCell(MappedValue, Movement): ...@@ -194,7 +194,7 @@ class DeliveryCell(MappedValue, Movement):
if len(item_result_list) == 1 : if len(item_result_list) == 1 :
try : try :
object = item_result_list[0].getObject() object = item_result_list[0].getObject()
except : except AttributeError:
object = None object = None
else : else :
object = None object = None
......
...@@ -265,7 +265,7 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated): ...@@ -265,7 +265,7 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated):
if len(item_result_list) == 1 : if len(item_result_list) == 1 :
try : try :
object = item_result_list[0].getObject() object = item_result_list[0].getObject()
except : except AttributeError:
object = None object = None
else : else :
object = None object = None
......
...@@ -58,7 +58,7 @@ class Entity: ...@@ -58,7 +58,7 @@ class Entity:
""" """
try: try:
return self.getDefaultAddressValue().asText() return self.getDefaultAddressValue().asText()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultAddressStreetAddress') security.declareProtected(Permissions.View, 'getDefaultAddressStreetAddress')
...@@ -68,7 +68,7 @@ class Entity: ...@@ -68,7 +68,7 @@ class Entity:
""" """
try: try:
return self.getDefaultAddressValue().getStreetAddress() return self.getDefaultAddressValue().getStreetAddress()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultAddressCity') security.declareProtected(Permissions.View, 'getDefaultAddressCity')
...@@ -78,7 +78,7 @@ class Entity: ...@@ -78,7 +78,7 @@ class Entity:
""" """
try: try:
return self.getDefaultAddressValue().getCity() return self.getDefaultAddressValue().getCity()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultAddressRegion') security.declareProtected(Permissions.View, 'getDefaultAddressRegion')
...@@ -88,7 +88,7 @@ class Entity: ...@@ -88,7 +88,7 @@ class Entity:
""" """
try: try:
return self.getDefaultAddressValue().getRegion() return self.getDefaultAddressValue().getRegion()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultAddressZipCode') security.declareProtected(Permissions.View, 'getDefaultAddressZipCode')
...@@ -98,7 +98,7 @@ class Entity: ...@@ -98,7 +98,7 @@ class Entity:
""" """
try: try:
return self.getDefaultAddressValue().getZipCode() return self.getDefaultAddressValue().getZipCode()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultTelephoneText') security.declareProtected(Permissions.View, 'getDefaultTelephoneText')
...@@ -108,7 +108,7 @@ class Entity: ...@@ -108,7 +108,7 @@ class Entity:
""" """
try: try:
return self.getDefaultTelephone().asText() return self.getDefaultTelephone().asText()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultTelephoneNumber') security.declareProtected(Permissions.View, 'getDefaultTelephoneNumber')
...@@ -118,7 +118,7 @@ class Entity: ...@@ -118,7 +118,7 @@ class Entity:
""" """
try: try:
return self.getDefaultTelephone().getTelephoneNumber() return self.getDefaultTelephone().getTelephoneNumber()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultFaxText') security.declareProtected(Permissions.View, 'getDefaultFaxText')
...@@ -128,7 +128,7 @@ class Entity: ...@@ -128,7 +128,7 @@ class Entity:
""" """
try: try:
return self.getDefaultFax().asText() return self.getDefaultFax().asText()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultFaxNumber') security.declareProtected(Permissions.View, 'getDefaultFaxNumber')
...@@ -138,7 +138,7 @@ class Entity: ...@@ -138,7 +138,7 @@ class Entity:
""" """
try: try:
return self.getDefaultFax().getTelephoneNumber() return self.getDefaultFax().getTelephoneNumber()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultEmailText') security.declareProtected(Permissions.View, 'getDefaultEmailText')
...@@ -148,7 +148,7 @@ class Entity: ...@@ -148,7 +148,7 @@ class Entity:
""" """
try: try:
return self.getDefaultEmail().asText() return self.getDefaultEmail().asText()
except: except AttributeError:
return '' return ''
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultAddress') security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultAddress')
......
...@@ -826,7 +826,7 @@ class Item(XMLObject, Amount): ...@@ -826,7 +826,7 @@ class Item(XMLObject, Amount):
if date is None: if date is None:
try: try:
date = movement.getParent().getStopDate() date = movement.getParent().getStopDate()
except: except AttributeError:
pass pass
if date is not None and (at_date is None or date - at_date <= 0): if date is not None and (at_date is None or date - at_date <= 0):
current_owner = movement.getDestinationSectionValue() current_owner = movement.getDestinationSectionValue()
...@@ -834,12 +834,12 @@ class Item(XMLObject, Amount): ...@@ -834,12 +834,12 @@ class Item(XMLObject, Amount):
if current_owner is None: if current_owner is None:
try: try:
current_owner = movement.getParent().getDestinationSectionValue() current_owner = movement.getParent().getDestinationSectionValue()
except: except AttributeError:
pass pass
if previous_owner is None: if previous_owner is None:
try: try:
previous_owner = movement.getParent().getSourceSectionValue() previous_owner = movement.getParent().getSourceSectionValue()
except: except AttributeError:
pass pass
if current_owner is not None and previous_owner != current_owner: if current_owner is not None and previous_owner != current_owner:
delivery_list.append(movement) delivery_list.append(movement)
......
...@@ -152,7 +152,7 @@ identify a bank account.""" ...@@ -152,7 +152,7 @@ identify a bank account."""
# Standard accessor # Standard accessor
try: try:
result = Predicate.getProperty(self, key, d=d) result = Predicate.getProperty(self, key, d=d)
except: except AttributeError:
result = None result = None
return result return result
......
...@@ -303,7 +303,7 @@ class Movement(XMLObject, Amount): ...@@ -303,7 +303,7 @@ class Movement(XMLObject, Amount):
if quantity is None: if quantity is None:
return None return None
return quantity * price return quantity * price
except: except TypeError:
return None return None
security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationTotalAssetPrice') security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationTotalAssetPrice')
...@@ -319,7 +319,7 @@ class Movement(XMLObject, Amount): ...@@ -319,7 +319,7 @@ class Movement(XMLObject, Amount):
if quantity is None: if quantity is None:
return None return None
return quantity * price return quantity * price
except: except TypeError:
return None return None
# Causality computation # Causality computation
...@@ -528,7 +528,7 @@ class Movement(XMLObject, Amount): ...@@ -528,7 +528,7 @@ class Movement(XMLObject, Amount):
quantity = self.getQuantity() quantity = self.getQuantity()
try: try:
quantity = float(quantity) quantity = float(quantity)
except: except TypeError:
quantity = 0.0 quantity = 0.0
if quantity < 0: if quantity < 0:
return - quantity return - quantity
...@@ -543,7 +543,7 @@ class Movement(XMLObject, Amount): ...@@ -543,7 +543,7 @@ class Movement(XMLObject, Amount):
quantity = self.getQuantity() quantity = self.getQuantity()
try: try:
quantity = float(quantity) quantity = float(quantity)
except: except TypeError:
quantity = 0.0 quantity = 0.0
if quantity < 0: if quantity < 0:
return 0.0 return 0.0
...@@ -565,7 +565,7 @@ class Movement(XMLObject, Amount): ...@@ -565,7 +565,7 @@ class Movement(XMLObject, Amount):
return 0.0 return 0.0
try: try:
source_debit = float(source_debit) source_debit = float(source_debit)
except: except TypeError:
source_debit = 0.0 source_debit = 0.0
self.setQuantity(- source_debit) self.setQuantity(- source_debit)
...@@ -578,7 +578,7 @@ class Movement(XMLObject, Amount): ...@@ -578,7 +578,7 @@ class Movement(XMLObject, Amount):
return 0.0 return 0.0
try: try:
source_credit = float(source_credit) source_credit = float(source_credit)
except: except TypeError:
source_credit = 0.0 source_credit = 0.0
self.setQuantity(source_credit) self.setQuantity(source_credit)
......
...@@ -95,15 +95,11 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -95,15 +95,11 @@ class Resource(XMLMatrix, CoreResource, Variated):
base_category_list = (base_category_list,) base_category_list = (base_category_list,)
other_base_category_dict = dict([(i,1) for i in base_category_list]) other_base_category_dict = dict([(i,1) for i in base_category_list])
try:
other_variations = self.searchFolder( \ other_variations = self.searchFolder( \
portal_type=self.getPortalVariationTypeList(), portal_type=self.getPortalVariationTypeList(),
sort_on=[('title','ascending')]) sort_on=[('title','ascending')])
except: other_variations = [x.getObject() for x in other_variations]
other_variations = [] other_variations = [x for x in other_variations if x is not None]
other_variations = map(lambda x: x.getObject(), other_variations)
other_variations = filter(lambda x: x is not None, other_variations)
for object in other_variations: for object in other_variations:
for base_category in object.getVariationBaseCategoryList(): for base_category in object.getVariationBaseCategoryList():
...@@ -263,7 +259,7 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -263,7 +259,7 @@ class Resource(XMLMatrix, CoreResource, Variated):
def getDefaultDestinationAmountBis(self, unit=None, variation=None, REQUEST=None): def getDefaultDestinationAmountBis(self, unit=None, variation=None, REQUEST=None):
try: try:
return self.getDestinationReference() return self.getDestinationReference()
except: except AttributeError:
return None return None
# This patch is temporary and allows to circumvent name conflict in ZSQLCatalog process for Coramy # This patch is temporary and allows to circumvent name conflict in ZSQLCatalog process for Coramy
...@@ -272,7 +268,7 @@ class Resource(XMLMatrix, CoreResource, Variated): ...@@ -272,7 +268,7 @@ class Resource(XMLMatrix, CoreResource, Variated):
def getDefaultSourceAmountBis(self, unit=None, variation=None, REQUEST=None): def getDefaultSourceAmountBis(self, unit=None, variation=None, REQUEST=None):
try: try:
return self.getSourceReference() return self.getSourceReference()
except: except AttributeError:
return None return None
......
...@@ -832,7 +832,7 @@ class ERP5Generator(PortalGenerator): ...@@ -832,7 +832,7 @@ class ERP5Generator(PortalGenerator):
try: try:
# Use NuxUserGroups instead of the standard acl_users. # Use NuxUserGroups instead of the standard acl_users.
p.manage_addProduct['NuxUserGroups'].addUserFolderWithGroups() p.manage_addProduct['NuxUserGroups'].addUserFolderWithGroups()
except: except KeyError:
# No way. # No way.
PortalGenerator.setupUserFolder(self, p) PortalGenerator.setupUserFolder(self, p)
......
...@@ -78,7 +78,7 @@ class InventoryBrain(ZSQLBrain): ...@@ -78,7 +78,7 @@ class InventoryBrain(ZSQLBrain):
try: try:
resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url) resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url)
return resource.getQuantityUnit() return resource.getQuantityUnit()
except: except AttributeError:
return '' return ''
...@@ -136,7 +136,7 @@ class InventoryListBrain(ZSQLBrain): ...@@ -136,7 +136,7 @@ class InventoryListBrain(ZSQLBrain):
try: try:
resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url) resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url)
return resource.getQuantityUnit() return resource.getQuantityUnit()
except: except AttributeError:
return '' return ''
def getListItemUrl(self, cname_id, selection_index, selection_name): def getListItemUrl(self, cname_id, selection_index, selection_name):
...@@ -189,7 +189,7 @@ class InventoryListBrain(ZSQLBrain): ...@@ -189,7 +189,7 @@ class InventoryListBrain(ZSQLBrain):
resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url) resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url)
return '%s/Resource_movementHistoryView?%s&reset=1' % (resource.absolute_url(), return '%s/Resource_movementHistoryView?%s&reset=1' % (resource.absolute_url(),
make_query(variation_text=self.variation_text, selection_name=selection_name, selection_index=selection_index)) make_query(variation_text=self.variation_text, selection_name=selection_name, selection_index=selection_index))
except: except (AttributeError, KeyError):
return '' return ''
def getAggregateListText(self): def getAggregateListText(self):
......
...@@ -114,7 +114,7 @@ class CategoryTool(CopyContainer, CMFCategoryTool, BaseTool): ...@@ -114,7 +114,7 @@ class CategoryTool(CopyContainer, CMFCategoryTool, BaseTool):
while o.meta_type == 'ERP5 Category' or o.meta_type == 'CMF Category': while o.meta_type == 'ERP5 Category' or o.meta_type == 'CMF Category':
o = o.aq_parent o = o.aq_parent
uid_dict[(int(o.uid), bo_uid, 0)] = 1 # Non strict uid_dict[(int(o.uid), bo_uid, 0)] = 1 # Non strict
except: except (TypeError, KeyError):
LOG('WARNING: CategoriesTool',0, 'Unable to find uid for %s' % path) LOG('WARNING: CategoriesTool',0, 'Unable to find uid for %s' % path)
return uid_dict.keys() return uid_dict.keys()
......
...@@ -1358,7 +1358,7 @@ class SimulationTool (BaseTool): ...@@ -1358,7 +1358,7 @@ class SimulationTool (BaseTool):
# XXX WARNING - ADD PRICED QUANTITY # XXX WARNING - ADD PRICED QUANTITY
cell_price = movement.getPrice() cell_price = movement.getPrice()
cell_total_price += movement.getNetConvertedTargetQuantity() * cell_price cell_total_price += movement.getNetConvertedTargetQuantity() * cell_price
except: except TypeError:
cell_total_price = None cell_total_price = None
for category in movement.getCategoryList(): for category in movement.getCategoryList():
if category not in cell_category_list: if category not in cell_category_list:
......
...@@ -154,7 +154,7 @@ class Variated(Base): ...@@ -154,7 +154,7 @@ class Variated(Base):
""" """
try: try:
resource = self.getDefaultResourceValue() resource = self.getDefaultResourceValue()
except: except AttributeError:
resource = None resource = None
if resource is not None: if resource is not None:
result = resource.getVariationBaseCategoryList() result = resource.getVariationBaseCategoryList()
...@@ -200,7 +200,7 @@ class Variated(Base): ...@@ -200,7 +200,7 @@ class Variated(Base):
""" """
try: try:
resource = self.getDefaultResourceValue() resource = self.getDefaultResourceValue()
except: except AttributeError:
resource = None resource = None
if resource is not None: if resource is not None:
clist = resource.getVariationRangeCategoryItemList(base_category_list = clist = resource.getVariationRangeCategoryItemList(base_category_list =
...@@ -217,7 +217,7 @@ class Variated(Base): ...@@ -217,7 +217,7 @@ class Variated(Base):
""" """
try: try:
resource = self.getDefaultResourceValue() resource = self.getDefaultResourceValue()
except: except AttributeError:
resource = None resource = None
if resource is not None: if resource is not None:
clist = resource.getVariationRangeCategoryItemList(base_category_list = clist = resource.getVariationRangeCategoryItemList(base_category_list =
...@@ -234,7 +234,7 @@ class Variated(Base): ...@@ -234,7 +234,7 @@ class Variated(Base):
""" """
try: try:
resource = self.getDefaultResourceValue() resource = self.getDefaultResourceValue()
except: except AttributeError:
resource = None resource = None
if resource is not None: if resource is not None:
clist = resource.getVariationRangeCategoryItemList(base_category_list = clist = resource.getVariationRangeCategoryItemList(base_category_list =
......
...@@ -37,6 +37,7 @@ from Products.ERP5Type import PropertySheet ...@@ -37,6 +37,7 @@ from Products.ERP5Type import PropertySheet
from urllib import quote from urllib import quote
from Globals import InitializeClass, PersistentMapping, DTMLFile from Globals import InitializeClass, PersistentMapping, DTMLFile
from AccessControl import Unauthorized, getSecurityManager, ClassSecurityInfo from AccessControl import Unauthorized, getSecurityManager, ClassSecurityInfo
from ZODB.POSException import ConflictError
from Products.ERP5Type.Utils import UpperCase from Products.ERP5Type.Utils import UpperCase
...@@ -85,6 +86,8 @@ def get_value(self, id, **kw): ...@@ -85,6 +86,8 @@ def get_value(self, id, **kw):
kw['cell'] = kw['REQUEST'] kw['cell'] = kw['REQUEST']
try: try:
value = tales_expr.__of__(self)(**kw) value = tales_expr.__of__(self)(**kw)
except ConflictError:
pass
except: except:
# We add this safety exception to make sure we always get # We add this safety exception to make sure we always get
# something reasonable rather than generate plenty of errors # something reasonable rather than generate plenty of errors
...@@ -117,7 +120,7 @@ def get_value(self, id, **kw): ...@@ -117,7 +120,7 @@ def get_value(self, id, **kw):
key = self.id key = self.id
key = key[3:] key = key[3:]
value = object.getProperty(key, d=value) value = object.getProperty(key, d=value)
except: except KeyError:
value = None value = None
# if normal value is a callable itself, wrap it # if normal value is a callable itself, wrap it
...@@ -194,7 +197,7 @@ def add_and_edit(self, id, REQUEST): ...@@ -194,7 +197,7 @@ def add_and_edit(self, id, REQUEST):
return return
try: try:
u = self.DestinationURL() u = self.DestinationURL()
except: except AttributeError:
u = REQUEST['URL1'] u = REQUEST['URL1']
if REQUEST['submit'] == " Add and Edit ": if REQUEST['submit'] == " Add and Edit ":
u = "%s/%s" % (u, quote(id)) u = "%s/%s" % (u, quote(id))
...@@ -419,7 +422,7 @@ class ERP5Form(ZMIForm, ZopePageTemplate): ...@@ -419,7 +422,7 @@ class ERP5Form(ZMIForm, ZopePageTemplate):
for k in self.get_field_ids(): for k in self.get_field_ids():
try: try:
self._delObject(k) self._delObject(k)
except: except AttributeError:
pass pass
self.groups = {} self.groups = {}
self.group_list = [] self.group_list = []
......
...@@ -44,6 +44,7 @@ from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain ...@@ -44,6 +44,7 @@ from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain
from Acquisition import aq_base, aq_inner, aq_parent, aq_self from Acquisition import aq_base, aq_inner, aq_parent, aq_self
from zLOG import LOG from zLOG import LOG
from ZODB.POSException import ConflictError
from Globals import InitializeClass, Persistent, Acquisition, get_request from Globals import InitializeClass, Persistent, Acquisition, get_request
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
...@@ -792,7 +793,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -792,7 +793,7 @@ class ListBoxWidget(Widget.Widget):
# Try to get the method through acquisition # Try to get the method through acquisition
try: try:
list_method = getattr(here, list_method.method_name) list_method = getattr(here, list_method.method_name)
except: except (AttributeError, KeyError):
pass pass
elif list_method in (None, ''): # Use current selection elif list_method in (None, ''): # Use current selection
# Use previously used list method # Use previously used list method
...@@ -808,7 +809,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -808,7 +809,7 @@ class ListBoxWidget(Widget.Widget):
# Try to get the method through acquisition # Try to get the method through acquisition
try: try:
count_method = getattr(here, count_method.method_name) count_method = getattr(here, count_method.method_name)
except: except (AttributeError, KeyError):
count_method = None count_method = None
else: else:
# No count method defined means that all objects must be retrieved. # No count method defined means that all objects must be retrieved.
...@@ -829,7 +830,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -829,7 +830,7 @@ class ListBoxWidget(Widget.Widget):
try: try:
stat_method = getattr(here, stat_method.method_name) stat_method = getattr(here, stat_method.method_name)
show_stat = 1 show_stat = 1
except: except (AttributeError, KeyError):
show_stat = 0 show_stat = 0
pass pass
else: else:
...@@ -889,7 +890,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -889,7 +890,7 @@ class ListBoxWidget(Widget.Widget):
select_expression += stats[index] + '(' + sql + ') AS ' + alias + ',' select_expression += stats[index] + '(' + sql + ') AS ' + alias + ','
else: else:
select_expression += '\'&nbsp;\' AS ' + alias + ',' select_expression += '\'&nbsp;\' AS ' + alias + ','
except: except KeyError:
select_expression += '\'&nbsp;\' AS ' + alias + ',' select_expression += '\'&nbsp;\' AS ' + alias + ','
index = index + 1 index = index + 1
...@@ -906,7 +907,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -906,7 +907,7 @@ class ListBoxWidget(Widget.Widget):
try: try:
start = REQUEST.get('list_start') start = REQUEST.get('list_start')
start = int(start) start = int(start)
except: except (TypeError, KeyError):
start = params.get('list_start',0) start = params.get('list_start',0)
start = int(start) start = int(start)
start = max(start, 0) start = max(start, 0)
...@@ -1124,7 +1125,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -1124,7 +1125,7 @@ class ListBoxWidget(Widget.Widget):
try: try:
method_path = getPath(here) + '/' + list_method.method_name method_path = getPath(here) + '/' + list_method.method_name
#LOG('ListBox', 0, 'method_path = %s, getPath = %s, list_method.method_name = %s' % (repr(method_path), repr(getPath(here)), repr(list_method.method_name))) #LOG('ListBox', 0, 'method_path = %s, getPath = %s, list_method.method_name = %s' % (repr(method_path), repr(getPath(here)), repr(list_method.method_name)))
except: except AttributeError:
method_path = getPath(here) + '/' + list_method.__name__ method_path = getPath(here) + '/' + list_method.__name__
#LOG('ListBox', 0, 'method_path = %s, getPath = %s, list_method.__name__ = %s' % (repr(method_path), repr(getPath(here)), repr(list_method.__name__))) #LOG('ListBox', 0, 'method_path = %s, getPath = %s, list_method.__name__ = %s' % (repr(method_path), repr(getPath(here)), repr(list_method.__name__)))
# Sometimes the seltion name is a list ??? Why ???? # Sometimes the seltion name is a list ??? Why ????
...@@ -1628,6 +1629,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1628,6 +1629,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
del kw['closed_summary'] del kw['closed_summary']
params = dict(kw) params = dict(kw)
selection.edit(params=params) selection.edit(params=params)
except ConflictError:
raise
except: except:
LOG('ListBox', 0, 'WARNING: Could not call %s with %s: ' % (repr(attribute_value), repr(params)), error=sys.exc_info()) LOG('ListBox', 0, 'WARNING: Could not call %s with %s: ' % (repr(attribute_value), repr(params)), error=sys.exc_info())
pass pass
...@@ -1637,7 +1640,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1637,7 +1640,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
if real_o is None: if real_o is None:
try: try:
real_o = o.getObject() real_o = o.getObject()
except: except AttributeError:
pass pass
if real_o is not None: if real_o is not None:
try: try:
...@@ -1651,11 +1654,11 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1651,11 +1654,11 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
attribute_original_value = attribute_value attribute_original_value = attribute_value
#LOG('Look up accessor %s' % cname_id,0,str(attribute_value)) #LOG('Look up accessor %s' % cname_id,0,str(attribute_value))
except: except AttributeError:
attribute_value = getattr(real_o,property_id) attribute_value = getattr(real_o,property_id)
attribute_original_value = attribute_value attribute_original_value = attribute_value
#LOG('Fallback to attribute %s' % cname_id,0,str(attribute_value)) #LOG('Fallback to attribute %s' % cname_id,0,str(attribute_value))
except: except AttributeError:
attribute_value = 'Can not evaluate attribute: %s' % sql attribute_value = 'Can not evaluate attribute: %s' % sql
attribute_original_value = None attribute_original_value = None
else: else:
...@@ -1669,6 +1672,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1669,6 +1672,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
except TypeError: except TypeError:
attribute_value = attribute_value() attribute_value = attribute_value()
attribute_original_value = attribute_value attribute_original_value = attribute_value
except ConflictError:
raise
except: except:
LOG('ListBox', 0, 'Could not evaluate', error=sys.exc_info()) LOG('ListBox', 0, 'Could not evaluate', error=sys.exc_info())
attribute_value = "Could not evaluate" attribute_value = "Could not evaluate"
...@@ -1759,6 +1764,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1759,6 +1764,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
list_body = list_body + \ list_body = list_body + \
("<td class=\"%s\" align=\"%s\"><a href=\"%s\">%s</a></td>" % ("<td class=\"%s\" align=\"%s\"><a href=\"%s\">%s</a></td>" %
(td_css, td_align, object_url, attribute_value)) (td_css, td_align, object_url, attribute_value))
except ConflictError:
raise
except: except:
LOG('ListBox', 0, 'Could not evaluate url_method %s' % column[1], error=sys.exc_info()) LOG('ListBox', 0, 'Could not evaluate url_method %s' % column[1], error=sys.exc_info())
list_body = list_body + \ list_body = list_body + \
...@@ -1773,7 +1780,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1773,7 +1780,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
list_body = list_body + \ list_body = list_body + \
("<td class=\"%s\" align=\"%s\"><a href=\"%s\">%s</a></td>" % ("<td class=\"%s\" align=\"%s\"><a href=\"%s\">%s</a></td>" %
(td_css, td_align, object_url, attribute_value)) (td_css, td_align, object_url, attribute_value))
except: except AttributeError:
list_body = list_body + \ list_body = list_body + \
("<td class=\"%s\" align=\"%s\">%s</td>" % (td_css, td_align, attribute_value) ) ("<td class=\"%s\" align=\"%s\">%s</td>" % (td_css, td_align, attribute_value) )
else: else:
...@@ -1782,6 +1789,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1782,6 +1789,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
list_body = list_body + \ list_body = list_body + \
("<td class=\"%s\" align=\"%s\"><a href=\"%s\">%s</a></td>" % ("<td class=\"%s\" align=\"%s\"><a href=\"%s\">%s</a></td>" %
(td_css, td_align, object_url, attribute_value)) (td_css, td_align, object_url, attribute_value))
except ConflictError:
raise
except: except:
list_body = list_body + \ list_body = list_body + \
("<td class=\"%s\" align=\"%s\">%s</td>" % (td_css, td_align, attribute_value) ) ("<td class=\"%s\" align=\"%s\">%s</td>" % (td_css, td_align, attribute_value) )
...@@ -1854,6 +1863,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1854,6 +1863,8 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
#params['operator'] = stats[n] #params['operator'] = stats[n]
#value=value(**params) #value=value(**params)
value=value(selection=selection) value=value(selection=selection)
except ConflictError:
raise
except: except:
LOG('ListBox', 0, 'WARNING: Could not call %s with %s: ' % (repr(value), repr(params)), error=sys.exc_info()) LOG('ListBox', 0, 'WARNING: Could not call %s with %s: ' % (repr(value), repr(params)), error=sys.exc_info())
pass pass
...@@ -1883,7 +1894,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1883,7 +1894,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
#if render_format == 'list': current_listboxline.addColumn( column[1] , None) #if render_format == 'list': current_listboxline.addColumn( column[1] , None)
if render_format == 'list': if render_format == 'list':
current_listboxline.addColumn( column[0] , None) current_listboxline.addColumn( column[0] , None)
except: except KeyError:
list_body += '<td class="Data">&nbsp;</td>' list_body += '<td class="Data">&nbsp;</td>'
#if render_format == 'list': current_listboxline.addColumn( column[1] , None) #if render_format == 'list': current_listboxline.addColumn( column[1] , None)
if render_format == 'list': current_listboxline.addColumn( extended_columns[n][0] , None) if render_format == 'list': current_listboxline.addColumn( extended_columns[n][0] , None)
......
...@@ -39,6 +39,7 @@ from urllib import quote ...@@ -39,6 +39,7 @@ from urllib import quote
from Globals import InitializeClass, PersistentMapping, DTMLFile, get_request from Globals import InitializeClass, PersistentMapping, DTMLFile, get_request
from AccessControl import Unauthorized, getSecurityManager, ClassSecurityInfo from AccessControl import Unauthorized, getSecurityManager, ClassSecurityInfo
import urllib2 import urllib2
from ZODB.POSException import ConflictError
from Products.ERP5Type.Utils import UpperCase from Products.ERP5Type.Utils import UpperCase
...@@ -75,7 +76,7 @@ def add_and_edit(self, id, REQUEST): ...@@ -75,7 +76,7 @@ def add_and_edit(self, id, REQUEST):
return return
try: try:
u = self.DestinationURL() u = self.DestinationURL()
except: except AttributeError:
u = REQUEST['URL1'] u = REQUEST['URL1']
if REQUEST['submit'] == " Add and Edit ": if REQUEST['submit'] == " Add and Edit ":
u = "%s/%s" % (u, quote(id)) u = "%s/%s" % (u, quote(id))
...@@ -230,6 +231,8 @@ if HAS_ZODB_RESOURCE_HANDLER: ...@@ -230,6 +231,8 @@ if HAS_ZODB_RESOURCE_HANDLER:
if callable(obj): if callable(obj):
try: try:
obj = obj() obj = obj()
except ConflictError:
raise
except: except:
pass pass
...@@ -259,6 +262,8 @@ else: ...@@ -259,6 +262,8 @@ else:
if callable(obj): if callable(obj):
try: try:
obj = obj() obj = obj()
except ConflictError:
raise
except: except:
pass pass
......
...@@ -370,7 +370,7 @@ def createLineObject(meta_types,selection,selection_name,field,REQUEST,list_meth ...@@ -370,7 +370,7 @@ def createLineObject(meta_types,selection,selection_name,field,REQUEST,list_meth
# Try to get the method through acquisition # Try to get the method through acquisition
try: try:
list_method = getattr(here, list_method.method_name) list_method = getattr(here, list_method.method_name)
except: except AttributeError:
pass pass
elif list_method in (None, ''): # Use current selection elif list_method in (None, ''): # Use current selection
list_method = None list_method = None
......
...@@ -156,7 +156,7 @@ def add_and_edit(self, id, REQUEST): ...@@ -156,7 +156,7 @@ def add_and_edit(self, id, REQUEST):
return return
try: try:
u = self.DestinationURL() u = self.DestinationURL()
except: except AttributeError:
u = REQUEST['URL1'] u = REQUEST['URL1']
if REQUEST['submit'] == " Add and Edit ": if REQUEST['submit'] == " Add and Edit ":
u = "%s/%s" % (u, quote(id)) u = "%s/%s" % (u, quote(id))
......
...@@ -308,10 +308,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -308,10 +308,10 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
try: try:
current_zoom=self.params['zoom'] current_zoom=self.params['zoom']
if current_zoom != None: if current_zoom != None:
return self.params['zoom'] return current_zoom
else: else:
return 1 return 1
except: except KeyError:
return 1 return 1
security.declarePublic('getReportList') security.declarePublic('getReportList')
......
...@@ -399,7 +399,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -399,7 +399,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
if selection is not None: if selection is not None:
try: try:
return selection.stats return selection.stats
except: except AttributeError:
return stats # That is really bad programming XXX return stats # That is really bad programming XXX
else: else:
return stats return stats
...@@ -1095,7 +1095,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -1095,7 +1095,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
# be sure that method name is correct # be sure that method name is correct
try: try:
method_count = string.atoi(method_count_string) method_count = string.atoi(method_count_string)
except: except TypeError:
return aq_base_name return aq_base_name
else: else:
...@@ -1103,7 +1103,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -1103,7 +1103,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
# be sure that method name is correct # be sure that method name is correct
try: try:
sub_index = string.atoi(method_count_string_list[1]) sub_index = string.atoi(method_count_string_list[1])
except: except TypeError:
return aq_base_name return aq_base_name
else: else:
sub_index = None sub_index = None
......
...@@ -32,6 +32,7 @@ from Products.ERP5Type import Permissions ...@@ -32,6 +32,7 @@ from Products.ERP5Type import Permissions
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Acquisition import aq_base, aq_inner, aq_chain, aq_acquire from Acquisition import aq_base, aq_inner, aq_chain, aq_acquire
from ZODB.POSException import ConflictError
import datetime import datetime
...@@ -170,11 +171,11 @@ class BaobabConduit(ERP5Conduit): ...@@ -170,11 +171,11 @@ class BaobabConduit(ERP5Conduit):
# Modules below are not always required # Modules below are not always required
# (it depends of the nature of objects you want to synchronize) # (it depends of the nature of objects you want to synchronize)
try: cash_inventory_module = object.cash_inventory_module try: cash_inventory_module = object.cash_inventory_module
except: cash_inventory_module = None except KeyError: cash_inventory_module = None
try: bank_account_inventory_module = object.bank_account_inventory_module try: bank_account_inventory_module = object.bank_account_inventory_module
except: bank_account_inventory_module = None except KeyError: bank_account_inventory_module = None
try: currency_cash_module = object.currency_cash_module try: currency_cash_module = object.currency_cash_module
except: currency_cash_module = None except KeyError: currency_cash_module = None
subobject = None subobject = None
...@@ -190,6 +191,8 @@ class BaobabConduit(ERP5Conduit): ...@@ -190,6 +191,8 @@ class BaobabConduit(ERP5Conduit):
parent_object_path = erp5_site_path + path parent_object_path = erp5_site_path + path
try: try:
parent_object = object.restrictedTraverse(parent_object_path) parent_object = object.restrictedTraverse(parent_object_path)
except ConflictError:
raise
except: except:
LOG( 'BaobabConduit:' LOG( 'BaobabConduit:'
, 100 , 100
......
...@@ -78,7 +78,7 @@ class Setter(Method): ...@@ -78,7 +78,7 @@ class Setter(Method):
if file_upload: if file_upload:
try: try:
o = getattr(instance, self._storage_id) o = getattr(instance, self._storage_id)
except: except AttributeError:
# We create a default type # We create a default type
o = instance.PUT_factory(self._storage_id, o = instance.PUT_factory(self._storage_id,
file_upload.headers.get('content-type', None), file_upload ) file_upload.headers.get('content-type', None), file_upload )
......
...@@ -39,7 +39,7 @@ def identity(value): ...@@ -39,7 +39,7 @@ def identity(value):
def asFloat(value): def asFloat(value):
try: try:
result = float(value) result = float(value)
except: except TypeError:
result = type_definition['float']['default'] result = type_definition['float']['default']
return result return result
...@@ -49,21 +49,21 @@ def asDate(value): ...@@ -49,21 +49,21 @@ def asDate(value):
result = value result = value
else: else:
result = DateTime(value) result = DateTime(value)
except: except TypeError:
result = type_definition['date']['default'] result = type_definition['date']['default']
return result return result
def asInt(value): def asInt(value):
try: try:
result = int(value) result = int(value)
except: except TypeError:
result = type_definition['int']['default'] result = type_definition['int']['default']
return result return result
def asLong(value): def asLong(value):
try: try:
result = long(value) result = long(value)
except: except TypeError:
result = type_definition['long']['default'] result = type_definition['long']['default']
return result return result
...@@ -73,7 +73,7 @@ def asString(value): ...@@ -73,7 +73,7 @@ def asString(value):
result = '' result = ''
else: else:
result = str(value) result = str(value)
except: except TypeError:
result = type_definition['string']['default'] result = type_definition['string']['default']
return result return result
......
...@@ -813,6 +813,8 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -813,6 +813,8 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
#LOG("Changing attr: ",0, key) #LOG("Changing attr: ",0, key)
try: try:
ERP5PropertyManager._setProperty(self, key, value, type=type) ERP5PropertyManager._setProperty(self, key, value, type=type)
except ConflictError:
raise
except: except:
# This should be removed if we want strict property checking # This should be removed if we want strict property checking
setattr(self, key, value) setattr(self, key, value)
...@@ -861,6 +863,8 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -861,6 +863,8 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
#LOG("Changing attr: ",0, key) #LOG("Changing attr: ",0, key)
try: try:
ERP5PropertyManager._setPropValue(self, key, value) ERP5PropertyManager._setPropValue(self, key, value)
except ConflictError:
raise
except: except:
# This should be removed if we want strict property checking # This should be removed if we want strict property checking
setattr(self, key, value) setattr(self, key, value)
...@@ -878,6 +882,8 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -878,6 +882,8 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
method = getattr(self, accessor_name) method = getattr(self, accessor_name)
try: try:
return method() return method()
except ConflictError:
raise
except: except:
return 0 return 0
else: else:
...@@ -916,10 +922,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -916,10 +922,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
Each time attributes of an object are updated, they should Each time attributes of an object are updated, they should
be updated through this generic edit method be updated through this generic edit method
""" """
try:
categoryIds = self._getCategoryTool().getBaseCategoryIds() categoryIds = self._getCategoryTool().getBaseCategoryIds()
except:
categoryIds = []
id_changed = 0 id_changed = 0
self._v_modified_property_dict = {} self._v_modified_property_dict = {}
for key in kw.keys(): for key in kw.keys():
...@@ -1520,7 +1523,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -1520,7 +1523,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
def getIntId(self): def getIntId(self):
try: try:
return int(self.getId()) return int(self.getId())
except: except TypeError:
return None return None
# Default views # Default views
......
...@@ -300,13 +300,13 @@ def ActionProviderBase_extractAction( self, properties, index ): ...@@ -300,13 +300,13 @@ def ActionProviderBase_extractAction( self, properties, index ):
if type( visible ) is not type( 0 ): if type( visible ) is not type( 0 ):
try: try:
visible = int( visible ) visible = int( visible )
except: except TypeError:
visible = 0 visible = 0
if type( optional ) is not type( 0 ): if type( optional ) is not type( 0 ):
try: try:
optional = int( optional ) optional = int( optional )
except: except TypeError:
optional = 0 optional = 0
if type( permissions ) is type( '' ): if type( permissions ) is type( '' ):
......
...@@ -26,6 +26,7 @@ from Acquisition import aq_base ...@@ -26,6 +26,7 @@ from Acquisition import aq_base
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Globals import PersistentMapping, MessageDialog from Globals import PersistentMapping, MessageDialog
from Products.ERP5Type.Utils import get_request from Products.ERP5Type.Utils import get_request
from Products.CMFCore.WorkflowCore import WorkflowException
from zLOG import LOG from zLOG import LOG
import re import re
...@@ -206,12 +207,12 @@ class CopyContainer: ...@@ -206,12 +207,12 @@ class CopyContainer:
source_item = '/'.join(copied_item_list[0]) source_item = '/'.join(copied_item_list[0])
try : try :
pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item) pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item)
except : except WorkflowException:
pass pass
else : else :
try : try :
pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId()) pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId())
except : except WorkflowException:
pass pass
......
...@@ -116,7 +116,7 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -116,7 +116,7 @@ class FolderMixIn(ExtensionClass.Base):
if id_group is None or id_group=='None': if id_group is None or id_group=='None':
try: try:
my_id = int(self.getLastId()) my_id = int(self.getLastId())
except: except TypeError:
my_id = 1 my_id = 1
while self.hasContent(str(my_id)): while self.hasContent(str(my_id)):
my_id = my_id + 1 my_id = my_id + 1
...@@ -455,7 +455,7 @@ be a problem).""" ...@@ -455,7 +455,7 @@ be a problem)."""
try: try:
newob = to_class(obase.id) newob = to_class(obase.id)
newob.id = obase.id # This line activates obase. newob.id = obase.id # This line activates obase.
except: except AttributeError:
newob = to_class(id) newob = to_class(id)
newob.id = id newob.id = id
keys = obase.__dict__.keys() keys = obase.__dict__.keys()
......
...@@ -1393,7 +1393,7 @@ def createDefaultAccessors(property_holder, id, prop = None, ...@@ -1393,7 +1393,7 @@ def createDefaultAccessors(property_holder, id, prop = None,
default = prop.get('default') default = prop.get('default')
try: try:
default = default[0] default = default[0]
except: except TypeError:
default = None default = None
accessor_name = 'get' + UpperCase(id) accessor_name = 'get' + UpperCase(id)
base_accessor = List.Getter(accessor_name, id, prop['type'], default = default, base_accessor = List.Getter(accessor_name, id, prop['type'], default = default,
...@@ -2568,7 +2568,7 @@ def assertAttributePortalType(o, attribute_name, portal_type): ...@@ -2568,7 +2568,7 @@ def assertAttributePortalType(o, attribute_name, portal_type):
if type(portal_type) is type('a'): portal_type = [portal_type] if type(portal_type) is type('a'): portal_type = [portal_type]
if getattr(o, attribute_name).portal_type not in portal_type: if getattr(o, attribute_name).portal_type not in portal_type:
o._delObject(attribute_name) o._delObject(attribute_name)
except: except (KeyError, AttributeError):
LOG("ERPType Warning: assertAttributePortalType",100,str(o.absolute_url())) LOG("ERPType Warning: assertAttributePortalType",100,str(o.absolute_url()))
##################################################### #####################################################
......
...@@ -706,6 +706,8 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -706,6 +706,8 @@ class ZCatalog(Folder, Persistent, Implicit):
try: try:
obj = self.aq_parent.unrestrictedTraverse(self.getpath(uid, sql_catalog_id=sql_catalog_id)) obj = self.aq_parent.unrestrictedTraverse(self.getpath(uid, sql_catalog_id=sql_catalog_id))
except ConflictError:
raise
except: except:
LOG('WARNING: ZSQLCatalog',0,'Could not find object for uid %s' % uid) LOG('WARNING: ZSQLCatalog',0,'Could not find object for uid %s' % uid)
obj = None obj = None
...@@ -903,7 +905,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -903,7 +905,7 @@ class ZCatalog(Folder, Persistent, Implicit):
except: return result except: return result
try: add_result=result.append try: add_result=result.append
except: except AttributeError:
raise AttributeError, `result` raise AttributeError, `result`
for id, ob in items: for id, ob in items:
...@@ -966,8 +968,12 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -966,8 +968,12 @@ class ZCatalog(Folder, Persistent, Implicit):
script=REQUEST.script script=REQUEST.script
if string.find(path, script) != 0: if string.find(path, script) != 0:
path='%s/%s' % (script, path) path='%s/%s' % (script, path)
try: return REQUEST.resolve_url(path) try:
except: pass return REQUEST.resolve_url(path)
except ConflictError:
raise
except:
pass
def resolve_path(self, path): def resolve_path(self, path):
""" """
...@@ -976,8 +982,12 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -976,8 +982,12 @@ class ZCatalog(Folder, Persistent, Implicit):
style url. If no object is found, None is returned. style url. If no object is found, None is returned.
No exceptions are raised. No exceptions are raised.
""" """
try: return self.unrestrictedTraverse(path) try:
except: pass return self.unrestrictedTraverse(path)
except ConflictError:
raise
except:
pass
def manage_normalize_paths(self, REQUEST, sql_catalog_id=None): def manage_normalize_paths(self, REQUEST, sql_catalog_id=None):
"""Ensure that all catalog paths are full physical paths """Ensure that all catalog paths are full physical paths
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import string import string
import Acquisition import Acquisition
import sys import sys
from ZODB.POSException import ConflictError
from zLOG import LOG from zLOG import LOG
...@@ -64,6 +65,8 @@ class ZSQLBrain(Acquisition.Implicit): ...@@ -64,6 +65,8 @@ class ZSQLBrain(Acquisition.Implicit):
REQUEST = self.REQUEST REQUEST = self.REQUEST
obj = self.aq_parent.portal_catalog.resolve_url(self.getPath(), REQUEST) obj = self.aq_parent.portal_catalog.resolve_url(self.getPath(), REQUEST)
return obj return obj
except ConflictError:
raise
except: except:
LOG("ZCatalog WARNING",0,"Could not access object path %s" % self.getPath(), error=sys.exc_info() ) LOG("ZCatalog WARNING",0,"Could not access object path %s" % self.getPath(), error=sys.exc_info() )
return None return None
...@@ -86,6 +89,10 @@ class ZSQLBrain(Acquisition.Implicit): ...@@ -86,6 +89,10 @@ class ZSQLBrain(Acquisition.Implicit):
script=REQUEST.script script=REQUEST.script
if string.find(path, script) != 0: if string.find(path, script) != 0:
path='%s/%s' % (script, path) path='%s/%s' % (script, path)
try: return REQUEST.resolve_url(path) try:
except: pass return REQUEST.resolve_url(path)
except ConflictError:
raise
except:
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment