Commit 69329a4f authored by Jérome Perrin's avatar Jérome Perrin

forge: drop "Base_viewOrphanObjectList" and related

this code is full of errors and does not seem referenced
parent fab90fe6
installed_bts = context.getPortalObject()['portal_templates'].getInstalledBusinessTemplatesList()
for bt in installed_bts:
if file in bt.getItemsList():
return bt.getId()
built_bts = context.getPortalObject()['portal_templates'].getBuiltBusinessTemplatesList()
for bt in built_bts:
if file in bt.getItemsList():
return bt.getId()
return None
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>file, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getOriginalBusinessTemplateId</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.Document import newTempBase
## Stuff that is ignored
#- everything that is not in a portal_*
#- portal_trash, portal_categories, portal_templates, portal_preferences
#- objects whose meta-type is 'External Method' or 'Filesystem*'
#- 'portal_skins/external_method' & 'portal_skins/custom'
#- 'portal_workflow/business_template_building_workflow' & 'portal_workflow/business_template_installation_workflow'
#- 'portal_catalog/erp5_mysql' & 'portal_catalog/cps3_mysql' & 'portal_types/Business Template'
##
portals_scanned = ['portal_actions', 'portal_memberdata', 'portal_skins', 'portal_types', 'portal_undo', 'portal_url', 'portal_workflow', 'portal_discussion', 'portal_membership', 'portal_registration', 'portal_properties', 'portal_metadata', 'portal_syndication', 'portal_uidannotation', 'portal_uidgenerator', 'portal_uidhandler', 'portal_report', 'portal_rules', 'portal_ids', 'portal_simulation', 'portal_alarms', 'portal_domains', 'portal_deliveries', 'portal_orders', 'portal_catalog', 'portal_selections', 'portal_synchronizations', 'portal_activities']
orphans_list = []
if object is None:
object = context
objects = object.objectValues()
for o in objects:
object_path = '/'.join(o.getPhysicalPath()[2:])
if 'portal_skins/external_method' in object_path or \
'portal_skins/custom' in object_path or \
'portal_workflow/business_template_building_workflow' in object_path or \
'portal_workflow/business_template_installation_workflow' in object_path or \
'portal_catalog/erp5_mysql' in object_path or \
'portal_catalog/cps3_mysql' in object_path or\
'portal_types/Business Template' in object_path:
continue
if (object is not context) or (object_path.split('/')[0] in portals_scanned):
if not o.meta_type.startswith('Filesystem') and o.meta_type != 'External Method':
context.log("lol", object_path)
if not context.getPortalObject().Base_getOriginalBusinessTemplateId(file=object_path):
if object_path not in portals_scanned:
# orphan object
orphans_list.append(object_path)
# Recursively check children
orphans_list.extend([x.uid for x in context.Base_getOrphanObjects(object=o)])
object_list = []
for orphan in orphans_list:
my_dict = {}
my_dict['uid'] = orphan
temp_object = newTempBase(folder=context.getPortalObject(), id='1234')
temp_object.edit(**my_dict)
object_list.append(temp_object)
return object_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>object=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getOrphanObjects</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>bottom</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>title_orphan</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_viewOrphanObjectList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Base_viewOrphanObjectList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Orphan Files</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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