From be8f3552ffd18e01bd54764fff0992782ee04a3b Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Mon, 1 Jun 2009 12:07:13 +0000 Subject: [PATCH] minor changes: we prefer to use "is None" and "is not None" instead of "== None" and "!= None" git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27304 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Amount.py | 2 +- product/ERP5/Document/Delivery.py | 2 +- product/ERP5/Document/MailMessage.py | 4 ++-- product/ERP5/Document/Telephone.py | 2 +- product/ERP5/Document/Transformation.py | 2 +- product/ERP5/Document/TransformedResource.py | 10 +++++----- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/product/ERP5/Document/Amount.py b/product/ERP5/Document/Amount.py index fc4853648f..4eb62e1cc6 100644 --- a/product/ERP5/Document/Amount.py +++ b/product/ERP5/Document/Amount.py @@ -222,7 +222,7 @@ class Amount(Base, Variated): menus. """ resource = self.getResourceValue() - if resource != None: + if resource is not None: result = resource.getVariationCategoryItemList( omit_individual_variation=0,**kw) else: diff --git a/product/ERP5/Document/Delivery.py b/product/ERP5/Document/Delivery.py index f19438362b..42b6321a44 100644 --- a/product/ERP5/Document/Delivery.py +++ b/product/ERP5/Document/Delivery.py @@ -381,7 +381,7 @@ class Delivery(XMLObject, ImmobilisationDelivery): deferred_simulation_movement_list = [] # defer simulation movements - if start_date != None or stop_date != None: + if start_date is not None or stop_date is not None: for movement in movement_list: start_date = start_date or movement.getStartDate() stop_date = stop_date or movement.getStopDate() diff --git a/product/ERP5/Document/MailMessage.py b/product/ERP5/Document/MailMessage.py index 8d2db27a43..2cbab55d74 100644 --- a/product/ERP5/Document/MailMessage.py +++ b/product/ERP5/Document/MailMessage.py @@ -100,9 +100,9 @@ class MailMessage(Event, CMFMailInMessage): Sends a reply to this mail message. """ # We assume by default that we are replying to the sender - if from_url == None: + if from_url is None: from_url = self.getUrlString() - if to_url == None: + if to_url is None: to_url = self.getSender() if msg is not None and subject is not None: header = "From: %s\n" % from_url diff --git a/product/ERP5/Document/Telephone.py b/product/ERP5/Document/Telephone.py index b6807b9004..cbf4fb6725 100644 --- a/product/ERP5/Document/Telephone.py +++ b/product/ERP5/Document/Telephone.py @@ -259,7 +259,7 @@ class Telephone(Coordinate, Base): number_match = possible_number_match number_dict = number_match.groupdict() break - if number_match == None: + if number_match is None: from zLOG import LOG, WARNING msg = "Doesn't exist a regex to handle this telephone: ", \ coordinate_text diff --git a/product/ERP5/Document/Transformation.py b/product/ERP5/Document/Transformation.py index 1dbd829b09..2f61372c94 100644 --- a/product/ERP5/Document/Transformation.py +++ b/product/ERP5/Document/Transformation.py @@ -145,7 +145,7 @@ class Transformation(XMLObject, Predicate, Variated): base_category_list = self.getVariationBaseCategoryList() resource = self.getResourceValue() - if resource != None: + if resource is not None: result = resource.getVariationCategoryItemList( base_category_list=base_category_list, omit_individual_variation=omit_individual_variation, diff --git a/product/ERP5/Document/TransformedResource.py b/product/ERP5/Document/TransformedResource.py index 5609e6d328..93cfaea626 100644 --- a/product/ERP5/Document/TransformedResource.py +++ b/product/ERP5/Document/TransformedResource.py @@ -187,7 +187,7 @@ class TransformedResource(Predicate, XMLObject, XMLMatrix, Amount): error_string = '' # Add resource relation resource = self.getDefaultResourceValue() - if resource != None: + if resource is not None: tmp_amount.setResourceValue(resource) else: error_string += 'No resource defined on %s' % self.getRelativeUrl() @@ -261,8 +261,8 @@ class TransformedResource(Predicate, XMLObject, XMLMatrix, Amount): quantity = None # We will browse the mapped values and determine which apply cell_key_list = self.getCellKeyList(base_id='quantity') - if cell_key_list not in [(),[]]: - if context == None: + if cell_key_list not in [(),[]]: + if context is None: raise KeyError, \ "No context defined on TransformedResource '%s'" % \ (self.getRelativeUrl(), ) @@ -296,8 +296,8 @@ class TransformedResource(Predicate, XMLObject, XMLMatrix, Amount): variation_category_list = None # We will browse the mapped values and determine which apply cell_key_list = self.getCellKeyList( base_id = 'variation') - if cell_key_list not in [(),[]]: - if context == None: + if cell_key_list not in [(),[]]: + if context is None: raise KeyError, \ "No context defined on TransformedResource '%s'" % \ (self.getRelativeUrl(), ) -- 2.30.9