Commit 806d4c43 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Code simplification


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39870 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9bb46e11
...@@ -842,21 +842,22 @@ def writeLocalDocument(class_id, text, create=1, instance_home=None): ...@@ -842,21 +842,22 @@ def writeLocalDocument(class_id, text, create=1, instance_home=None):
def setDefaultClassProperties(property_holder): def setDefaultClassProperties(property_holder):
"""Initialize default properties for ERP5Type Documents. """Initialize default properties for ERP5Type Documents.
""" """
if not property_holder.__dict__.has_key('isPortalContent'): pdict = property_holder.__dict__
if not 'isPortalContent' in pdict:
property_holder.isPortalContent = PropertyConstantGetter('isPortalContent', property_holder.isPortalContent = PropertyConstantGetter('isPortalContent',
value=True) value=True)
if not property_holder.__dict__.has_key('isRADContent'): if not 'isRADContent' in pdict:
property_holder.isRADContent = 1 property_holder.isRADContent = 1
if not property_holder.__dict__.has_key('add_permission'): if not 'add_permission' in pdict:
property_holder.add_permission = Permissions.AddPortalContent property_holder.add_permission = Permissions.AddPortalContent
if not property_holder.__dict__.has_key('__implements__'): if not '__implements__' in pdict:
property_holder.__implements__ = () property_holder.__implements__ = ()
if not property_holder.__dict__.has_key('property_sheets'): if not 'property_sheets' in pdict:
property_holder.property_sheets = () property_holder.property_sheets = ()
# Add default factory type information # Add default factory type information
if not property_holder.__dict__.has_key('factory_type_information') and \ if not 'factory_type_information' in pdict and \
property_holder.__dict__.has_key('meta_type') and \ 'meta_type' in pdict and 'portal_type' in pdict:
property_holder.__dict__.has_key('portal_type'): name = property_holder.__name__
property_holder.factory_type_information = \ property_holder.factory_type_information = \
{ 'id' : property_holder.portal_type { 'id' : property_holder.portal_type
, 'meta_type' : property_holder.meta_type , 'meta_type' : property_holder.meta_type
...@@ -864,13 +865,13 @@ def setDefaultClassProperties(property_holder): ...@@ -864,13 +865,13 @@ def setDefaultClassProperties(property_holder):
"Type generated by ERPType") "Type generated by ERPType")
, 'icon' : 'document_icon.gif' , 'icon' : 'document_icon.gif'
, 'product' : 'ERP5Type' , 'product' : 'ERP5Type'
, 'factory' : 'add%s' % property_holder.__name__ , 'factory' : 'add%s' % name
, 'immediate_view' : '%s_view' % property_holder.__name__ , 'immediate_view' : '%s_view' % name
, 'actions' : , 'actions' :
( { 'id' : 'view' ( { 'id' : 'view'
, 'name' : 'View' , 'name' : 'View'
, 'category' : 'object_view' , 'category' : 'object_view'
, 'action' : '%s_view' % property_holder.__name__ , 'action' : '%s_view' % name
, 'permissions' : ( Permissions.View, ) , 'permissions' : ( Permissions.View, )
}, },
) )
......
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