Commit 0489a54f authored by Jérome Perrin's avatar Jérome Perrin

fix SyntaxWarning

parent 94369990
......@@ -111,7 +111,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
| morphology/2 | (colour/blue, colour/red, size/Man, size/Woman, morphology/2)
"""
result = []
if base_category_list is ():
if base_category_list == ():
base_category_list = self.getVariationBaseCategoryList(
omit_individual_variation=omit_individual_variation)
elif isinstance(base_category_list, str):
......@@ -127,7 +127,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
if not omit_individual_variation:
for variation in individual_variation_list:
for base_category in variation.getVariationBaseCategoryList():
if base_category_list is ()\
if base_category_list == ()\
or base_category in base_category_list:
other_base_category_set.discard(base_category)
# XXX now, call Renderer a lot of time.
......@@ -196,7 +196,7 @@ class Resource(XMLObject, XMLMatrix, VariatedMixin):
for base_category in variation.getVariationBaseCategoryList():
# backwards compatbility: if individual_bc_list is empty, allow
# all individual variation base categories.
if (base_category_list is ()
if (base_category_list == ()
or base_category in base_category_list)\
and (not len(individual_bc_list)
or base_category in individual_bc_list):
......
......@@ -77,7 +77,7 @@ try:
if checkFieldType(my_field, 'MultiRelationStringField'):
# The checkProperty sometimes does not provide an
# acceptable value - XXXX - see vetement_id in Modele View
if old_value is '' or old_value is None:
if old_value == '' or old_value is None:
old_value = []
try:
old_value = list(old_value)
......
......@@ -138,7 +138,7 @@ class PropertyTranslationDomainGetter(BaseGetter):
ptype_domain = ''
else:
ptype_domain = domain.getDomainName()
if ptype_domain is '' and default is not None:
if ptype_domain == '' and default is not None:
# then get the default property defined on property sheet
value = default
else:
......
......@@ -1014,10 +1014,10 @@ class Base(
result = None
else:
if isinstance(value, (list, tuple)):
if len(value) is 0:
result = None
else:
if len(value):
result = value[0]
else:
result = None
else:
result = value
else:
......@@ -1048,10 +1048,10 @@ class Base(
result = None
else:
if isinstance(value, (list, tuple)):
if len(value) is 0:
result = None
else:
if len(value):
result = value[0]
else:
result = None
else:
result = value
else:
......@@ -1092,10 +1092,10 @@ class Base(
result = None
else:
if isinstance(value, (list, tuple)):
if len(value) is 0:
result = None
else:
if len(value):
result = value[0]
else:
result = None
else:
result = value
else:
......
......@@ -76,7 +76,7 @@ class ContentExistenceConstraint(ConstraintMixin):
# Otherwise, generate an error message
mapping = {}
if portal_type is ():
if not portal_type:
message_id = 'message_no_subobject'
else:
message_id = 'message_no_subobject_portal_type'
......
......@@ -898,7 +898,7 @@ def save_bytes(self, tag, data):
v = b''.join(data[2:])
encoding = a.get('encoding', 'repr')
assert encoding == 'base64'
if encoding is not '':
if encoding != '':
v = unconvert(encoding, v)
if self.binary:
l = len(v)
......@@ -922,7 +922,7 @@ def save_unicode(self, tag, data):
for x in data[2:]:
v=v+x
encoding=a.get('encoding','repr') # JPS: repr is default encoding
if encoding is not '':
if encoding != '':
v=unconvert(encoding,v)
if binary:
l=len(v)
......
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