Commit b05e8776 authored by Jérome Perrin's avatar Jérome Perrin

fix SyntaxWarning

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