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
No related merge requests found
......@@ -8,7 +8,7 @@ def getPropertySheetList(self, portal_type):
portal).getPropertySheetList()
def getPropertySheetAttributeList(name):
def getPropertySheetAttributeList(self, name):
from Products.ERP5Type import PropertySheet
class_ = PropertySheet.__dict__.get(name, None)
result = []
......@@ -17,6 +17,14 @@ def getPropertySheetAttributeList(name):
continue
# we want to get only normal property.
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
......
......@@ -66,6 +66,7 @@ if export_tsv:\n
return printed\n
else:\n
portal_catalog = context.portal_catalog\n
num = 0\n
for i in result:\n
item_list = portal_catalog(portal_type=\'Glossary Term\',\n
reference=i[\'reference\'], language_id=i[\'language\'],\n
......@@ -81,9 +82,10 @@ else:\n
business_field=i[\'business_field\'],\n
title=i[\'title\'], description=i[\'description\'],\n
comment=i[\'field_path\'])\n
num += 1\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
......@@ -137,9 +139,11 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag
<string>map</string>
<string>_getitem_</string>
<string>portal_catalog</string>
<string>num</string>
<string>item_list</string>
<string>len</string>
<string>new_id</string>
<string>_inplacevar_</string>
<string>portal_status_message</string>
</tuple>
</value>
......
......@@ -66,6 +66,7 @@ if export_tsv:\n
return printed\n
else:\n
portal_catalog = context.portal_catalog\n
num = 0\n
for i in result:\n
item_list = portal_catalog(portal_type=\'Glossary Term\',\n
reference=i[\'reference\'], language_id=i[\'language\'],\n
......@@ -81,9 +82,10 @@ else:\n
business_field=i[\'business_field\'],\n
title=i[\'title\'], description=i[\'description\'],\n
comment=i[\'field_path\'])\n
num += 1\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
......@@ -137,9 +139,11 @@ context.Base_redirect(keep_items={\'portal_status_message\':portal_status_messag
<string>map</string>
<string>_getitem_</string>
<string>portal_catalog</string>
<string>num</string>
<string>item_list</string>
<string>len</string>
<string>new_id</string>
<string>_inplacevar_</string>
<string>portal_status_message</string>
</tuple>
</value>
......
423
\ No newline at end of file
424
\ 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