Commit 5884c2d8 authored by Thierry's avatar Thierry

*** empty log message ***


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@67 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ec4b0a59
......@@ -29,14 +29,39 @@ def getCodeArticleClient(self) :
self -- an amount (movement, delivery line, etc.)
"""
coloris = self.getColoris()
taille = self.getTaille()
morphologie = self.getMorphologie()
coloris = self.getColoris()
resource = self.getResource()
resource_value = self.getResourceValue()
if resource_value is None:
return ''
<<<<<<< CodeArticleClient.py
else :
variated_reference_list = resource_value.contentValues(filter={'portal_type':'Variated Reference'})
# we search a variated_reference wich define 'code_article'
my_variated_reference = None
for variated_reference in variated_reference_list :
if len(variated_reference.getMappedValuePropertyList()) <> 0 :
if variated_reference.getMappedValuePropertyList()[0] == 'code_article' :
my_variated_reference = variated_reference
break
predicate_value = []
if my_variated_reference is not None :
base_category_list = my_variated_reference.getVariationBaseCategoryList()
if 'coloris' in base_category_list and coloris :
predicate_value.append('coloris/'+coloris)
if 'taille' in base_category_list and taille :
predicate_value.append('taille/'+taille)
if 'morphologie' in base_category_list and morphologie :
predicate_value.append('morphologie/'+morphologie)
predicate_value.sort()
key = tuple([resource] + predicate_value)
if code_article_client.has_key(key):
return code_article_client[key] # This is an infinite cache
=======
else :
variated_reference_list = resource_value.contentValues(filter={'portal_type':'Variated Reference'})
# we search a variated_reference wich define 'code_article'
......@@ -60,6 +85,7 @@ def getCodeArticleClient(self) :
key = tuple([resource] + predicate_value)
if code_article_client.has_key(key):
return code_article_client[key] # This is an infinite cache
>>>>>>> 1.2
# Build cache
if my_variated_reference is not None :
......
......@@ -29,6 +29,7 @@ def getTailleClient(self) :
self -- an amount (movement, delivery line, etc.)
"""
coloris = self.getColoris()
taille = self.getTaille()
morphologie = self.getMorphologie()
resource = self.getResource()
......@@ -38,16 +39,37 @@ def getTailleClient(self) :
except :
morpho_type = None
predicate_value = []
for predicate_item in (taille, morpho_type):
if predicate_item:
predicate_value.append(predicate_item)
predicate_value.sort()
key = tuple([resource] + predicate_value)
if taille_client.has_key(key):
return taille_client[key] # This is an infinite cache
if resource_value is None:
return taille.split('/')[-1]
else :
correspondance_taille = resource_value.getSpecialiseValue(portal_type=['Correspondance Tailles'])
predicate_value = []
if correspondance_taille is not None:
if len(correspondance_taille.getTailleList())>0 and taille :
predicate_value.append(taille)
if len(correspondance_taille.getMorphoTypeList())>0 and morphologie :
predicate_value.append(morpho_type)
predicate_value.sort()
key = tuple([resource] + predicate_value)
if taille_client.has_key(key):
return taille_client[key] # This is an infinite cache
# Build cache
<<<<<<< TailleClient.py
if correspondance_taille is not None:
mapped_value_list = correspondance_taille.objectValues()
# Fill the cache
for cell in mapped_value_list:
predicate_value = []
for predicate_value_item in cell.getPredicateValueList():
if predicate_value_item <> 'value' :
predicate_value.append(predicate_value_item)
predicate_value.sort()
new_key = tuple([resource] + predicate_value)
taille_client[new_key] = cell.getProperty(key='taille_client')
else :
return taille.split('/')[-1]
=======
if resource_value is None:
return taille.split('/')[-1]
......@@ -62,6 +84,7 @@ def getTailleClient(self) :
predicate_value.sort()
new_key = tuple([resource] + predicate_value)
taille_client[new_key] = cell.getProperty(key='taille_client')
>>>>>>> 1.4
if taille_client.has_key(key):
return taille_client[key]
......
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