Commit 712bd50b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

2008-12-26 kazuhiko

* import categories in Property Type in Glossary view.
* display total number of imported documents.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24987 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b34a54a6
...@@ -8,7 +8,7 @@ def getPropertySheetList(self, portal_type): ...@@ -8,7 +8,7 @@ def getPropertySheetList(self, portal_type):
portal).getPropertySheetList() portal).getPropertySheetList()
def getPropertySheetAttributeList(name): def getPropertySheetAttributeList(self, name):
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
class_ = PropertySheet.__dict__.get(name, None) class_ = PropertySheet.__dict__.get(name, None)
result = [] result = []
...@@ -17,6 +17,14 @@ def getPropertySheetAttributeList(name): ...@@ -17,6 +17,14 @@ def getPropertySheetAttributeList(name):
continue continue
# we want to get only normal property. # we want to get only normal property.
result.append((i['id'], i.get('description', ''))) result.append((i['id'], i.get('description', '')))
for i in getattr(class_, '_categories', ()):
try:
result.append((i, self.getPortalObject().portal_categories[i].getDescription()))
except KeyError:
result.append((i, ''))
except TypeError:
# if category is Expression(...), TypeError raises
pass
return result return result
......
...@@ -66,6 +66,7 @@ if export_tsv:\n ...@@ -66,6 +66,7 @@ if export_tsv:\n
return printed\n return printed\n
else:\n else:\n
portal_catalog = context.portal_catalog\n portal_catalog = context.portal_catalog\n
num = 0\n
for i in result:\n for i in result:\n
item_list = portal_catalog(portal_type=\'Glossary Term\',\n item_list = portal_catalog(portal_type=\'Glossary Term\',\n
reference=i[\'reference\'], language_id=i[\'language\'],\n reference=i[\'reference\'], language_id=i[\'language\'],\n
...@@ -81,9 +82,10 @@ else:\n ...@@ -81,9 +82,10 @@ else:\n
business_field=i[\'business_field\'],\n business_field=i[\'business_field\'],\n
title=i[\'title\'], description=i[\'description\'],\n title=i[\'title\'], description=i[\'description\'],\n
comment=i[\'field_path\'])\n comment=i[\'field_path\'])\n
num += 1\n
\n \n
\n \n
portal_status_message = context.Base_translateString(\'Terms created.\')\n portal_status_message = context.Base_translateString(\'%d terms created.\' % num)\n
context.Base_redirect(keep_items={\'portal_status_message\':portal_status_message})\n context.Base_redirect(keep_items={\'portal_status_message\':portal_status_message})\n
...@@ -137,9 +139,11 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag ...@@ -137,9 +139,11 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag
<string>map</string> <string>map</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>portal_catalog</string> <string>portal_catalog</string>
<string>num</string>
<string>item_list</string> <string>item_list</string>
<string>len</string> <string>len</string>
<string>new_id</string> <string>new_id</string>
<string>_inplacevar_</string>
<string>portal_status_message</string> <string>portal_status_message</string>
</tuple> </tuple>
</value> </value>
......
...@@ -66,6 +66,7 @@ if export_tsv:\n ...@@ -66,6 +66,7 @@ if export_tsv:\n
return printed\n return printed\n
else:\n else:\n
portal_catalog = context.portal_catalog\n portal_catalog = context.portal_catalog\n
num = 0\n
for i in result:\n for i in result:\n
item_list = portal_catalog(portal_type=\'Glossary Term\',\n item_list = portal_catalog(portal_type=\'Glossary Term\',\n
reference=i[\'reference\'], language_id=i[\'language\'],\n reference=i[\'reference\'], language_id=i[\'language\'],\n
...@@ -81,9 +82,10 @@ else:\n ...@@ -81,9 +82,10 @@ else:\n
business_field=i[\'business_field\'],\n business_field=i[\'business_field\'],\n
title=i[\'title\'], description=i[\'description\'],\n title=i[\'title\'], description=i[\'description\'],\n
comment=i[\'field_path\'])\n comment=i[\'field_path\'])\n
num += 1\n
\n \n
\n \n
portal_status_message = context.Base_translateString(\'Terms created.\')\n portal_status_message = context.Base_translateString(\'%d terms created.\' % num)\n
context.Base_redirect(keep_items={\'portal_status_message\':portal_status_message})\n context.Base_redirect(keep_items={\'portal_status_message\':portal_status_message})\n
...@@ -137,9 +139,11 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag ...@@ -137,9 +139,11 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag
<string>map</string> <string>map</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>portal_catalog</string> <string>portal_catalog</string>
<string>num</string>
<string>item_list</string> <string>item_list</string>
<string>len</string> <string>len</string>
<string>new_id</string> <string>new_id</string>
<string>_inplacevar_</string>
<string>portal_status_message</string> <string>portal_status_message</string>
</tuple> </tuple>
</value> </value>
......
423 424
\ 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