Commit e1cc7fc2 authored by Ivan Tyagov's avatar Ivan Tyagov

Make it possible to edit portal type icon from ERP5 UI.

Encode again as utf-8 random text excerpts.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35904 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ce7b0d3
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
<string>my_type_acquire_local_role</string> <string>my_type_acquire_local_role</string>
<string>my_type_property_sheet_list</string> <string>my_type_property_sheet_list</string>
<string>my_type_base_category_list</string> <string>my_type_base_category_list</string>
<string>my_type_icon</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_type_icon</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Icon</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
"""\n """\n
from Products.ERP5.Document.Document import NotConvertedError\n from Products.ERP5.Document.Document import NotConvertedError\n
\n \n
encoding = \'utf-8\'\n
is_gadget_mode = context.REQUEST.get(\'is_gadget_mode\', 0)\n is_gadget_mode = context.REQUEST.get(\'is_gadget_mode\', 0)\n
\n \n
if is_gadget_mode:\n if is_gadget_mode:\n
...@@ -73,9 +74,9 @@ if is_gadget_mode:\n ...@@ -73,9 +74,9 @@ if is_gadget_mode:\n
def getRandomDocumentTextExcerpt(document_text):\n def getRandomDocumentTextExcerpt(document_text):\n
# try to get somewhat arbitrary choice of searchable attrs\n # try to get somewhat arbitrary choice of searchable attrs\n
if isinstance(document_text, str) and document_text!=\'\':\n if isinstance(document_text, str) and document_text!=\'\':\n
document_text = document_text.decode(\'utf-8\', \'ignore\')\n document_text = document_text.decode(encoding, \'ignore\')\n
start = min(len(document_text) - 300, 200)\n start = min(len(document_text) - 300, 200)\n
return \'... %s ...\' %document_text[start:start + max_text_length]\n return \'... %s ...\' %document_text[start:start + max_text_length].encode(encoding)\n
else:\n else:\n
return \'\'\n return \'\'\n
\n \n
...@@ -124,8 +125,8 @@ else:\n ...@@ -124,8 +125,8 @@ else:\n
result = \' \'.join(map(str, found_text_fragments))\n result = \' \'.join(map(str, found_text_fragments))\n
\n \n
# Document may contains charactors which utf8 codec cannot decode.\n # Document may contains charactors which utf8 codec cannot decode.\n
unicode_result = result.decode(\'utf-8\', \'ignore\')\n unicode_result = result.decode(encoding, \'ignore\')\n
result = unicode_result.encode(\'utf-8\')\n result = unicode_result.encode(encoding)\n
\n \n
return result\n return result\n
...@@ -172,6 +173,7 @@ else:\n ...@@ -172,6 +173,7 @@ else:\n
<string>max_text_length</string> <string>max_text_length</string>
<string>Products.ERP5.Document.Document</string> <string>Products.ERP5.Document.Document</string>
<string>NotConvertedError</string> <string>NotConvertedError</string>
<string>encoding</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>is_gadget_mode</string> <string>is_gadget_mode</string>
......
1596 1597
\ No newline at end of file \ 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