Commit 65e856c1 authored by Nicolas Delaby's avatar Nicolas Delaby

Convert Strings in unicode

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20711 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e538c12f
......@@ -155,6 +155,13 @@ def getSubLineList(obj):\n
sub_list.extend(getSubLineList(x))\n
return sub_list\n
\n
def unicodeDict(d):\n
for k, v in d.items():\n
if isinstance(v, str):\n
d.update({k:unicode(v, \'utf8\')})\n
return d\n
\n
\n
for line in getSubLineList(context):\n
prod_desc = line.getResource() is not None and line.getResourceValue().getDescription() or \'\'\n
desc = getProductAndLineDesc(prod_desc, line.getDescription())\n
......@@ -190,7 +197,7 @@ for line in getSubLineList(context):\n
\'total_price\': line.getTotalPrice() or \'\',\n
}\n
total_price += line.getTotalPrice() or 0.0\n
line_list.append(line_dict.copy())\n
line_list.append(unicodeDict(line_dict.copy()))\n
\n
data_dict = {\n
\'source_section_title\': context.getSourceSectionTitle() or \'\',\n
......@@ -202,13 +209,13 @@ data_dict = {\n
\'source_section_email\': getEmail(context.getSourceSection() and context.getSourceSectionValue().getEmailText() or \'\'),\n
\n
\'source_decision_title\': context.getSourceDecisionTitle() or \'\',\n
\'source_decision_address\': unicode(getOneLineAddress(\n
\'source_decision_address\':getOneLineAddress(\n
context.getSourceDecision() and context.getSourceDecisionValue().getDefaultAddressText() or \'\',\n
context.getSourceDecision() and context.getSourceDecisionValue().getDefaultAddressRegionTitle() or \'\'), \'utf8\'),\n
context.getSourceDecision() and context.getSourceDecisionValue().getDefaultAddressRegionTitle() or \'\'),\n
\'source_decision_telfax\': getPhoneAndFax(context.getSourceDecision() and context.getSourceDecisionValue().getTelephoneText() or \'\',\n
context.getSourceDecision() and context.getSourceDecisionValue().getFaxText() or \'\'),\n
\'source_decision_email\': getEmail(context.getSourceDecision() and context.getSourceDecisionValue().getEmailText() or \'\'),\n
\'source_decision_vatid\': unicode(getVatId(context.getSourceDecision() and context.getSourceDecisionValue().getVatCode() or \'\'), \'utf8\'),\n
\'source_decision_vatid\': getVatId(context.getSourceDecision() and context.getSourceDecisionValue().getVatCode() or \'\'),\n
\n
\'destination_title\': context.getDestinationTitle() or \'\',\n
\'destination_address\': getOneLineAddress(\n
......@@ -218,16 +225,16 @@ data_dict = {\n
context.getDestination() and context.getDestinationValue().getFaxText() or \'\'),\n
\'destination_email\': getEmail(context.getDestination() and context.getDestinationValue().getEmailText() or \'\'),\n
\n
\'destination_section_title\': unicode(context.getDestinationSectionTitle() or \'\', \'utf8\'),\n
\'destination_section_title\': context.getDestinationSectionTitle() or \'\',\n
\'destination_section_image_path\': context.getDestinationSectionValue() is not None and context.getDestinationSectionValue().getDefaultImagePath() or \'\',\n
\'destination_section_address\': unicode(getOneLineAddress(\n
\'destination_section_address\': getOneLineAddress(\n
context.getDestinationSection() and context.getDestinationSectionValue().getDefaultAddressText() or \'\',\n
context.getDestinationSection() and context.getDestinationSectionValue().getDefaultAddressRegionTitle() or \'\'), \'utf8\'),\n
\'destination_section_telfax\': unicode(getPhoneAndFax(\n
context.getDestinationSection() and context.getDestinationSectionValue().getDefaultAddressRegionTitle() or \'\'),\n
\'destination_section_telfax\': getPhoneAndFax(\n
context.getDestinationSection() and context.getDestinationSectionValue().getTelephoneText() or \'\',\n
context.getDestinationSection() and context.getDestinationSectionValue().getTelephoneText() or \'\'), \'utf8\'),\n
\'destination_section_email\': unicode(getEmail(context.getDestinationSection() and context.getDestinationSectionValue().getEmailText() or \'\'), \'utf8\'),\n
\'destination_section_vatid\': unicode(getVatId(context.getDestinationSection() and context.getDestinationSectionValue().getVatCode() or \'\'), \'utf8\'),\n
context.getDestinationSection() and context.getDestinationSectionValue().getTelephoneText() or \'\'),\n
\'destination_section_email\': getEmail(context.getDestinationSection() and context.getDestinationSectionValue().getEmailText() or \'\'),\n
\'destination_section_vatid\': getVatId(context.getDestinationSection() and context.getDestinationSectionValue().getVatCode() or \'\'),\n
\n
\'destination_decision_title\': context.getDestinationDecisionTitle() or \'\',\n
\'destination_decision_telfax\': getPhoneAndFax(context.getDestinationDecision() and context.getDestinationDecisionValue().getTelephoneText() or \'\',\n
......@@ -249,7 +256,7 @@ data_dict = {\n
\'line_list\': line_list,\n
}\n
\n
return data_dict\n
return unicodeDict(data_dict)\n
</string> </value>
</item>
<item>
......@@ -316,6 +323,7 @@ return data_dict\n
<string>total_price</string>
<string>total_vat</string>
<string>getSubLineList</string>
<string>unicodeDict</string>
<string>_getiter_</string>
<string>line</string>
<string>None</string>
......@@ -323,7 +331,6 @@ return data_dict\n
<string>desc</string>
<string>line_dict</string>
<string>_inplacevar_</string>
<string>unicode</string>
<string>data_dict</string>
</tuple>
</value>
......
......@@ -155,6 +155,12 @@ def getSubLineList(obj):\n
sub_list.extend(getSubLineList(x))\n
return sub_list\n
\n
def unicodeDict(d):\n
for k, v in d.items():\n
if isinstance(v, str):\n
d.update({k:unicode(v, \'utf8\')})\n
return d\n
\n
for line in getSubLineList(context):\n
prod_desc = line.getResource() is not None and line.getResourceValue().getDescription() or \'\'\n
desc = getProductAndLineDesc(prod_desc, line.getDescription())\n
......@@ -173,26 +179,26 @@ for line in getSubLineList(context):\n
\'total_price\': line.getTotalPrice() or \'\',\n
}\n
total_price += line.getTotalPrice() or 0.0\n
line_list.append(line_dict.copy())\n
line_list.append(unicodeDict(line_dict.copy()))\n
\n
data_dict = {\n
\'source_section_title\': context.getSourceSectionTitle() or \'\',\n
\'source_section_address\': unicode(getOneLineAddress(\n
\'source_section_address\': getOneLineAddress(\n
context.getSourceSection() and context.getSourceSectionValue().getDefaultAddressText() or \'\',\n
context.getSourceSection() and context.getSourceSectionValue().getDefaultAddressRegionTitle() or \'\'), \'utf8\'),\n
context.getSourceSection() and context.getSourceSectionValue().getDefaultAddressRegionTitle() or \'\'),\n
\'source_section_telfax\': getPhoneAndFax(context.getSourceSection() and context.getSourceSectionValue().getTelephoneText() or \'\',\n
context.getSourceSection() and context.getSourceSectionValue().getFaxText() or \'\'),\n
\'source_section_email\': getEmail(context.getSourceSection() and context.getSourceSectionValue().getEmailText() or \'\'),\n
\'source_section_vatid\': unicode(getVatId(context.getSourceSection() and context.getSourceSectionValue().getVatCode() or \'\'), \'utf8\'),\n
\'source_section_vatid\': getVatId(context.getSourceSection() and context.getSourceSectionValue().getVatCode() or \'\'),\n
\n
\'source_decision_title\': context.getSourceDecisionTitle() or \'\',\n
\'source_decision_address\': unicode(getOneLineAddress(\n
\'source_decision_address\': getOneLineAddress(\n
context.getSourceDecision() and context.getSourceDecisionValue().getDefaultAddressText() or \'\',\n
context.getSourceDecision() and context.getSourceDecisionValue().getDefaultAddressRegionTitle() or \'\'), \'utf8\'),\n
context.getSourceDecision() and context.getSourceDecisionValue().getDefaultAddressRegionTitle() or \'\'),\n
\'source_decision_telfax\': getPhoneAndFax(context.getSourceDecision() and context.getSourceDecisionValue().getTelephoneText() or \'\',\n
context.getSourceDecision() and context.getSourceDecisionValue().getFaxText() or \'\'),\n
\'source_decision_email\': getEmail(context.getSourceDecision() and context.getSourceDecisionValue().getEmailText() or \'\'),\n
\'source_decision_vatid\': unicode(getVatId(context.getSourceDecision() and context.getSourceDecisionValue().getVatCode() or \'\'), \'utf8\'),\n
\'source_decision_vatid\': getVatId(context.getSourceDecision() and context.getSourceDecisionValue().getVatCode() or \'\'),\n
\n
\'destination_title\': context.getDestinationTitle() or \'\',\n
\'destination_address\': getOneLineAddress(\n
......@@ -202,16 +208,16 @@ data_dict = {\n
context.getDestination() and context.getDestinationValue().getFaxText() or \'\'),\n
\'destination_email\': getEmail(context.getDestination() and context.getDestinationValue().getEmailText() or \'\'),\n
\n
\'destination_section_title\': unicode(context.getDestinationSectionTitle() or \'\', \'utf8\'),\n
\'destination_section_title\': context.getDestinationSectionTitle() or \'\',\n
\'destination_section_image_path\': context.getDestinationSectionValue() is not None and context.getDestinationSectionValue().getDefaultImagePath() or \'\',\n
\'destination_section_address\': unicode(getOneLineAddress(\n
\'destination_section_address\': getOneLineAddress(\n
context.getDestinationSection() and context.getDestinationSectionValue().getDefaultAddressText() or \'\',\n
context.getDestinationSection() and context.getDestinationSectionValue().getDefaultAddressRegionTitle() or \'\'), \'utf8\'),\n
\'destination_section_telfax\': unicode(getPhoneAndFax(\n
context.getDestinationSection() and context.getDestinationSectionValue().getDefaultAddressRegionTitle() or \'\'),\n
\'destination_section_telfax\': getPhoneAndFax(\n
context.getDestinationSection() and context.getDestinationSectionValue().getTelephoneText() or \'\',\n
context.getDestinationSection() and context.getDestinationSectionValue().getTelephoneText() or \'\'), \'utf8\'),\n
\'destination_section_email\': unicode(getEmail(context.getDestinationSection() and context.getDestinationSectionValue().getEmailText() or \'\'), \'utf8\'),\n
\'destination_section_vatid\': unicode(getVatId(context.getDestinationSection() and context.getDestinationSectionValue().getVatCode() or \'\'), \'utf8\'),\n
context.getDestinationSection() and context.getDestinationSectionValue().getTelephoneText() or \'\'),\n
\'destination_section_email\': getEmail(context.getDestinationSection() and context.getDestinationSectionValue().getEmailText() or \'\'),\n
\'destination_section_vatid\': getVatId(context.getDestinationSection() and context.getDestinationSectionValue().getVatCode() or \'\'),\n
\n
\'destination_decision_title\': context.getDestinationDecisionTitle() or \'\',\n
\'destination_decision_telfax\': getPhoneAndFax(context.getDestinationDecision() and context.getDestinationDecisionValue().getTelephoneText() or \'\',\n
......@@ -233,7 +239,7 @@ data_dict = {\n
\'line_list\': line_list,\n
}\n
\n
return data_dict\n
return unicodeDict(data_dict)\n
</string> </value>
</item>
<item>
......@@ -300,6 +306,7 @@ return data_dict\n
<string>total_price</string>
<string>total_vat</string>
<string>getSubLineList</string>
<string>unicodeDict</string>
<string>_getiter_</string>
<string>line</string>
<string>None</string>
......@@ -307,7 +314,6 @@ return data_dict\n
<string>desc</string>
<string>line_dict</string>
<string>_inplacevar_</string>
<string>unicode</string>
<string>data_dict</string>
</tuple>
</value>
......
331
\ No newline at end of file
332
\ 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