Commit c2b34b0d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

a document with empty language is available for any language.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45687 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4f6a7003
......@@ -90,8 +90,8 @@ if validation_state is None:\n
web_page_list = portal_catalog(reference=name,\n
portal_type=valid_portal_type_list,\n
validation_state=validation_state,\n
language=language,\n
sort_on=[(\'version\', \'descending\')],\n
language=(language, \'\'),\n
sort_on=[(\'language\', \'descending\'), (\'version\', \'descending\')],\n
group_by=(\'reference\',),\n
**kw)\n
\n
......
......@@ -95,7 +95,8 @@ kw</string> </value>
catalog.creation_date,\n
catalog.title,\n
CONCAT(CASE my_versioning.language\n
WHEN <dtml-sqlvar language type="string"> THEN \'3\'\n
WHEN <dtml-sqlvar language type="string"> THEN \'4\'\n
WHEN \'\' THEN \'3\'\n
WHEN \'en\' THEN \'2\'\n
ELSE \'1\' END,\n
my_versioning.version) AS priority\n
......@@ -118,7 +119,7 @@ kw</string> </value>
\n
<dtml-if all_languages>\n
<dtml-else>\n
AND my_versioning.language = <dtml-sqlvar language type="string">\n
AND my_versioning.language IN (<dtml-sqlvar language type="string">, \'\')\n
</dtml-if>\n
\n
<dtml-if is_translation_order_by>\n
......
1043
\ No newline at end of file
1044
\ No newline at end of file
......@@ -432,12 +432,13 @@ Hé Hé Hé!""", page.asText().strip())
'13' : dict(language = 'en' , version = "3" , reference = "D"),
'14' : dict(language = 'ja' , version = "2" , reference = "E"),
'15' : dict(language = 'pt' , version = "2" , reference = "F"),
'16' : dict(language = '' , version = "1" , reference = "A"),
}
sequence_one = property_dict.keys()
sequence_two = ['01', '13', '12', '09', '06', '15' , '04', '11', '02', '05', '03',
'07', '10', '08', '14' ]
'07', '10', '08', '14', '16']
sequence_three = ['05', '12', '13', '14', '06', '09', '10', '07', '03', '01', '02',
'11', '04', '08' , '15']
'11', '04', '08' , '15', '16']
sequence_count = 0
for sequence in [ sequence_one , sequence_two , sequence_three ]:
......@@ -491,6 +492,11 @@ Hé Hé Hé!""", page.asText().strip())
self.assertEqual(['ja' , 'ja', 'ja', 'ja'],
[ w.getLanguage() for w in ja_document_value_list])
bg_document_value_list = websection.getDocumentValueList(language='bg')
self.assertEqual(1, len(bg_document_value_list))
self.assertEqual([''],
[ w.getLanguage() for w in bg_document_value_list])
# Testing for all_versions parameter
en_document_value_list = websection.getDocumentValueList(all_versions=1)
self.assertEqual(5, len(en_document_value_list))
......@@ -551,6 +557,22 @@ Hé Hé Hé!""", page.asText().strip())
self.assertEqual(['3'], [ w.getVersion() for w in ja_document_value_list \
if w.getLanguage() == 'en'])
bg_document_value_list = websection.WebSection_getDocumentValueListBase(all_languages=1,
language='bg')
self.assertEqual(6, len(bg_document_value_list))
self.assertEqual(0, len([ w.getLanguage() for w in bg_document_value_list \
if w.getLanguage() == 'bg']))
self.assertEqual(3, len([ w.getLanguage() for w in bg_document_value_list \
if w.getLanguage() == 'en']))
self.assertEqual(1, len([ w.getLanguage() for w in bg_document_value_list \
if w.getLanguage() == 'pt']))
self.assertEqual(['3'], [ w.getVersion() for w in bg_document_value_list \
if w.getLanguage() == 'pt'])
self.assertEqual(1, len([ w.getLanguage() for w in bg_document_value_list \
if w.getLanguage() == 'ja']))
self.assertEqual(['3'], [ w.getVersion() for w in bg_document_value_list \
if w.getLanguage() == 'ja'])
# Tests for all_languages and all_versions
en_document_value_list = websection.WebSection_getDocumentValueListBase(all_languages=1,
all_versions=1)
......@@ -566,7 +588,7 @@ Hé Hé Hé!""", page.asText().strip())
for document_value_list in [ en_document_value_list, pt_document_value_list ,
ja_document_value_list]:
self.assertEqual(15, len(document_value_list))
self.assertEqual(16, len(document_value_list))
self.assertEqual(5, len([ w.getLanguage() for w in document_value_list \
if w.getLanguage() == 'en']))
self.assertEqual(5, len([ w.getLanguage() for w in en_document_value_list \
......
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