Commit 18ae2acd authored by Yusuke Muraoka's avatar Yusuke Muraoka

2010-04-02 yusuke

* Fixed the column name conflict.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34257 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5b7eeb7f
......@@ -68,7 +68,7 @@ VALUES\n
<dtml-in "content_translation_dict_list">\n
(<dtml-sqlvar "_[\'sequence-item\'][\'uid\']" type=int>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'property_name\']" type=string>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'language\']" type=string>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'content_language\']" type=string>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'translated_text\']" type=string>\n
)\n
<dtml-unless sequence-end>,</dtml-unless>\n
......@@ -122,7 +122,7 @@ VALUES\n
<dtml-in "content_translation_dict_list">\n
(<dtml-sqlvar "_[\'sequence-item\'][\'uid\']" type=int>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'property_name\']" type=string>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'language\']" type=string>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'content_language\']" type=string>,\n
<dtml-sqlvar "_[\'sequence-item\'][\'translated_text\']" type=string>\n
)\n
<dtml-unless sequence-end>,</dtml-unless>\n
......
......@@ -91,9 +91,9 @@
<value> <string>CREATE TABLE `content_translation` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`property_name` VARCHAR(100),\n
`language` VARCHAR(100),\n
`content_language` VARCHAR(100),\n
`translated_text` TEXT,\n
PRIMARY KEY (`uid`, `property_name`, `language`),\n
PRIMARY KEY (`uid`, `property_name`, `content_language`),\n
FULLTEXT `Translated Text` (`translated_text`)\n
) TYPE=MyISAM;\n
</string> </value>
......@@ -135,9 +135,9 @@
<value> <string>CREATE TABLE `content_translation` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`property_name` VARCHAR(100),\n
`language` VARCHAR(100),\n
`content_language` VARCHAR(100),\n
`translated_text` TEXT,\n
PRIMARY KEY (`uid`, `property_name`, `language`),\n
PRIMARY KEY (`uid`, `property_name`, `content_language`),\n
FULLTEXT `Translated Text` (`translated_text`)\n
) TYPE=MyISAM;\n
</string> </value>
......
......@@ -69,7 +69,7 @@ result = []\n
def upperCase(text):\n
return convertToUpperCase(text.replace(\'-\', \'_\'))\n
\n
language_list = context.Localizer.get_languages()\n
content_language_list = context.Localizer.get_languages()\n
\n
for document in document_list:\n
if document.getPortalType() not in portal_type_list:\n
......@@ -83,9 +83,9 @@ for document in document_list:\n
if original_method is not None:\n
original_text = original_method()\n
\n
for language in language_list:\n
for content_language in content_language_list:\n
method_name = \'get%s\' % (upperCase(\'%s_translated_%s\' %\n
(language, property_name)),)\n
(content_language, property_name)),)\n
translated_text = None\n
method = getattr(document, method_name, None)\n
if method is not None and document.getProperty(\'%s_translation_domain\' % property_name) == \'content\':\n
......@@ -93,20 +93,20 @@ for document in document_list:\n
else:\n
translation_method = getattr(document, \'get%s\' % upperCase(\'translated_%s\' % property_name), None)\n
if original_text is not None and translation_method is not None:\n
temporary_translated_text = translation_method(language=language)\n
temporary_translated_text = translation_method(language=content_language)\n
if original_text != temporary_translated_text:\n
translated_text = temporary_translated_text\n
if translated_text:\n
temporary_result.append({\'uid\': uid,\n
\'property_name\': property_name,\n
\'language\': language,\n
\'content_language\': content_language,\n
\'translated_text\': translated_text,\n
})\n
# also add original content\n
if original_text is not None:\n
temporary_result.append({\'uid\': uid,\n
\'property_name\': property_name,\n
\'language\': \'\',\n
\'content_language\': \'\',\n
\'translated_text\': original_text,\n
})\n
result.extend(temporary_result)\n
......@@ -156,7 +156,7 @@ return result\n
<string>upperCase</string>
<string>_getattr_</string>
<string>context</string>
<string>language_list</string>
<string>content_language_list</string>
<string>_getiter_</string>
<string>document</string>
<string>uid</string>
......@@ -166,7 +166,7 @@ return result\n
<string>original_text</string>
<string>getattr</string>
<string>original_method</string>
<string>language</string>
<string>content_language</string>
<string>method_name</string>
<string>translated_text</string>
<string>method</string>
......
2010-04-02 yusuke
* Fixed the column name conflict.
2010-03-03 yusuke
* Use sql_deferred_connection instead of sql_connection
......
27
\ No newline at end of file
29
\ No newline at end of file
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