Commit a0a792ae authored by Romain Courteaud's avatar Romain Courteaud

[HARDCODED] [romain_dev] wip tools

parent 2a15c3da
def getObjectByOid(self, oid):#XXXYYY
ob = self._p_jar[oid]
#return ob
result = [ob.__class__,]
n = 1
for k,v in ob.iteritems():
result.append((k, k.__class__,v, v.__class__))
n += 1
if n > 100:
break
return result
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>test_kaz</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.test_kaz</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
def testrc(self):
result = ''
portal = self.getPortalObject()
selection = portal.portal_selections.getSelectionFor('person_module_selection')
key_list = selection.__dict__.keys()
key_list.sort()
for key in key_list:
result += '%s: %s\n' % (key, selection.__dict__[key])
return result
return str(selection.__dict__)
print selection.checked_uids
print selection.domain_path
print selection.domain_list
if selection.domain is not None:
print selection.domain.asDomainDict()
return printed
return 'couscous'
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testrc</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.testrc</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>51.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>romain_dev</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5_update_catalog_list = ('erp5_ingestion_mysql_innodb_catalog', 'erp5_full_text_mroonga_catalog')
bt5_installation_list = bt5_update_catalog_list + ('erp5_xhtml_style',
# 'erp5_officejs', 'erp5_web_jabber_client',
# 'erp5_officejs_ooffice',
'erp5_upgrader',
'erp5_hal_json_style',
'erp5_ods_style',
'erp5_odt_style',
'erp5_deferred_style',
# 'erp5_officejs_ui_test',
'erp5_crm_renderjs_ui_test',
'erp5_trade_renderjs_ui_test',
'erp5_web_renderjs_ui_test',
'erp5_pdm_renderjs_ui_test',
'erp5_accounting_renderjs_ui_test',
'erp5_item_renderjs_ui_test',
# 'erp5_officejs_ui_test',
'erp5_officejs_support_request_ui_test',
# 'erp5_calendar',
# 'erp5_crm',
# 'erp5_mrp',
'erp5_project',
'erp5_bank_reconciliation',
# test dependencies
# 'erp5_configurator_standard_trade_template',
# 'erp5_simulation_test',
# 'erp5_accounting',
# 'erp5_monaco_editor_ui_test',
# 'erp5_gadget_interface_validator_ui_test',
'erp5_forge',
# 'erp5_web_jabber_client',
'erp5_web_ui_test',
'erp5_officejs_afs_directory_ui_test',
'erp5_accounting_ui_test',
'erp5_dms_ui_test',
# 'erp5_travel_expense', 'erp5_travel_expense_ui_test',
# 'officejs_olapy_demo', 'erp5_officejs_connector'
# 'erp5_discussion'
'erp5_hr',
'erp5_item',
'erp5_mrp',
'erp5_payroll',
'erp5_authentication_policy',
'erp5_l10n_fr',
'erp5_mrp_item',
'erp5_discount_resource',
'erp5_administration',
)
return bt5_installation_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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getUpgradeBusinessTemplateList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
can_delete = False
document_id = context.getId()
try:
can_delete = (document_id == str(int(document_id)))
except:
pass
if can_delete:
context.getParentValue().manage_delObjects(ids=[document_id])
return 'deleted'
return 'not deleted'
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Couscous_deleteIfExpectedId</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = portal = context.getPortalObject()
module_business_application_map = {'base': ('currency_module',
'organisation_module',
'person_module',),
'accounting': ('accounting_module',
'account_module',),
'forge': ('bug_module', 'glossary_module', 'test_result_module', 'test_suite_module'),
'dev': ('foo_module', 'bar_module', 'foo_bar_module'),
'project': ('project_module', 'task_module', 'task_report_module'),
'crm': ('campaign_module',
'event_module',
'meeting_module',
'sale_opportunity_module',
'support_request_module',),
'dms': ('document_module',
'image_module',
'document_ingestion_module',
'web_page_module',),
'trade': ('internal_packing_list_module',
'inventory_module',
'purchase_order_module',
'purchase_packing_list_module',
'purchase_trade_condition_module',
'returned_sale_packing_list_module',
'sale_order_module',
'sale_packing_list_module',
'sale_trade_condition_module'),
'pdm': ('component_module',
'product_module',
'purchase_supply_module',
'sale_supply_module',
'service_module',
'transformation_module',),
}
for business_application_category_id, module_ids in module_business_application_map.items():
for module_id in module_ids:
module = getattr(portal, module_id, None)
if module is not None:
module.edit(business_application = business_application_category_id)
return 'ok'
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_setupModuleList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
selection = portal.portal_selections.getSelectionFor('person_module_selection')
print selection.checked_uids
print selection.domain_path
print selection.domain_list
if selection.domain is not None:
print selection.domain.asDomainDict()
return printed
for _, obj in portal.portal_skins.ZopeFind(portal.portal_skins.erp5_core, obj_metatypes=('ERP5 Form',), search_sub=1):
if (obj.pt == 'form_view') and (obj.action == '') and ('FieldLibrary' not in obj.id):
print obj.id
return printed
return
portal_object = portal = context.getPortalObject()
module = portal.person_module
i = counter
while i <= min(counter + 100, 80000):
# module.newContent(portal_type='Person', title='test %i' % i)
i += 1
if i != counter:
module.activate(activity='SQLQueue', priority=5).testromain(i)
return 'couscous'
raise NotImplementedError('nutnut')
return '%s\n' % context.absolute_url()
from base64 import urlsafe_b64encode, urlsafe_b64decode
return 'data:text/css;base64,%s' % urlsafe_b64encode('couscous');
kw = {
# 'select_dict': {'count': 'select 1;drop table catalog;', 'portal_type': None},
'select_dict': {'count': 'count(*)', 'portal_type': None},
# 'select_list': ['count(*)', 'portal_type'],
# 'select_list': ['portal_type'],
'limit': None,
'group_by': ["portal_type"],
# 'sort_on': [('portal_type', 'ASC')]
}
print context.portal_catalog(src__=1, **kw)
"""
for x in context.portal_catalog(**kw):
print x.portal_type, x['count']
"""
print '---'
return printed
cp = context.manage_copyObjects(uids=uids)
context.manage_pasteObjects(cb_copy_data=cp)
return "couscous"
"""
result_list = context.portal_catalog.countResults(select_dict={'date': 'DATE_FORMAT(creation_date, "%s")' % sql_format, 'portal_type': None},
portal_type=portal_type_list,limit=None,
owner=reference,
group_by=['DATE_FORMAT(creation_date, "%s")' % sql_format, 'portal_type'],
**count_kw)
"""
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>copy_of_testromain</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
domain_list = [] # [<Temporary Domain at /erp5/portal_domains/my_module_domain/sub_domain>, ...]
##### Get parents' criterions ######
parents_criterion_dict = {} # {"portal_type": {"identity": ["Task Report"]}), ...}
parents_membership_criterion_category_set = set() # ["follow_up/project_module/xxx", ...]
sub_parent = parent
while depth > 0:
for criterion in sub_parent.getCriterionList():
property_id = criterion.property
if property_id not in parents_criterion_dict:
parents_criterion_dict[property_id] = {"min": criterion.min, "max": criterion.max, "identity": criterion.identity}
sub_parent_membership_criterion_category_list = sub_parent.getMembershipCriterionCategoryList()
# sub_parent.getMultimembershipCriterionBaseCategoryList() seems to return empty list...
parents_membership_criterion_category_set.update(sub_parent_membership_criterion_category_list)
depth -= 1
sub_parent = sub_parent.getParentValue()
##### Define domain_list.append helper #####
def appendNewTempDomain(id, criterion_dict=None, membership_criterion_category_list=None, **kw):
if criterion_dict is None:
criterion_dict = parents_criterion_dict
else:
criterion_dict.update(parents_criterion_dict)
if membership_criterion_category_list is None:
membership_criterion_category_list = list(parents_membership_criterion_category_set)
else:
membership_criterion_category_list = list(parents_membership_criterion_category_set.union(membership_criterion_category_list))
multimembership_criterion_base_category_list = list(set([c[:c.index("/")] for c in membership_criterion_category_list]))
domain = parent.generateTempDomain(id=id)
domain.edit(
criterion_property_list=criterion_dict.keys(),
multimembership_criterion_base_category_list=multimembership_criterion_base_category_list,
membership_criterion_category_list=membership_criterion_category_list,
domain_generator_method_id=script.id,
**kw
)
for property_id, criterion_kw in criterion_dict.items():
domain.setCriterion(property_id, **criterion_kw)
domain_list.append(domain)
##### Provide sub domains #####
# Don't define domain that provides criterions already used by parents
if "delivery.start_date" not in parents_criterion_dict:
now = DateTime()
for time_frame in (1, 7, 30, 365):
appendNewTempDomain(
id="sub_time_frame_{}".format(time_frame),
title="Last {} days".format(time_frame),
criterion_dict={"delivery.start_date": {"min": now - time_frame}},
)
person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if person is not None:
category_relative_url = "source/" + person.getRelativeUrl()
if category_relative_url not in parents_membership_criterion_category_set:
appendNewTempDomain(
id="sub_assigned_to_me_1",
title="Assigned to me",
membership_criterion_category_list=(category_relative_url,),
)
return domain_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>parent, depth</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>generateTristanDomain</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>getObjectByOid</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>test_kaz</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>getObjectByOid</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# you can pass oid like "?oid=0x123456"
if oid.startswith('0x'):
oid = ('\x00'*8 + oid[2:].decode('hex'))[-8:]
ob = context.getObjectByOid(oid)
print repr(ob)[:10*1024]
return printed
<?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>oid</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>printObjectByOid</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>testrc</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>testrc</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testrc</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>testrc</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
result = ''# '---<br>'
i = 0
for brain in context.getPortalObject().portal_catalog(portal_type='Action Information', sort_on=[['relative_url', 'ASC']]):
action = brain.getObject()
action_type = action.getActionType()
if not action.isVisible():
continue
if ('Template' in action.getParentTitle()):
continue
if (action_type in ['object_button']):
continue
# if (action_type in ['object_report', 'object_exchange']):
# continue
if ('web' in action_type) or ('jio' in action_type) or (action_type in ['object_view', 'object_list', 'object_jump', 'object_sort', 'object_ui', 'object_search']):
continue
i += 1
result += '%s %s %s %s' % (action.getParentTitle(), '<a href="%s">%s</a>' % (action.getRelativeUrl(), action.getTitle()), action.getActionType(), '<br>')
result = '--- %i<br>%s' % (i, result)
print result
return printed
# check selection content
portal = context.getPortalObject()
print '---'
for selection_id in ('bar_selection', 'foo_selection'):
print selection_id
params = portal.portal_selections.getSelectionParamsFor(selection_id)
print '%s' % str(params)
print portal.portal_selections.getSelectionColumns(selection_id)
print 'ok'
return printed
# delete all persons
context.portal_catalog.searchAndActivate(
portal_type='Person',
parent_uid=context.getUid(),
method_id='Couscous_deleteIfExpectedId'
)
return 'ok'
context.getPortalObject().notebook_module.olapy_notebook.edit(title="olapy_notebook.jsmd", reference="olapy_notebook.jsmd")
return "ok"
import time
time.sleep(360)
return 'cosucous'
portal_object = portal = context.getPortalObject()
module = portal.person_module
i = 0
while i < 80000:
module.newContent(portal_type='Person', title='test %i' % i)
i += 1
return 'couscous'
return 'ok'
from DateTime import DateTime
portal = context.getPortalObject()
token = portal.access_token_module.newContent(
id='%s-%s' % (DateTime().strftime('%Y%m%d'), portal.Base_generateAccessTokenHalID()),
portal_type='HAL Access Token',
agent='person_module/160295'
)
token.validate()
return token.getRelativeUrl()
from DateTime import DateTime
i = 0
while i < 700:
context.newContent(
portal_type='Test Result Line',
string_index=i,
title=i,
start_date=DateTime(),
duration=i,
all_tests=i,
errors=1,
failures=2,
skip=3,
)
i += 1
return 'ok'
context.portal_catalog.searchAndActivate(
portal_type='Person',
parent_uid=context.getUid(),
method_id='testromain2'
)
return 'ok'
context.portal_catalog.searchAndActivate(
portal_type='Person',
parent_uid=context.getUid(),
method_id='testromain2'
)
return 'ok'
return 'ok'
# python: here.Module_listWorkflowTransitionItemList()['form_id_dict'].get(request.get("field_your_mass_workflow_action", ""), '')
result = None
form_id_dict = context.Module_listWorkflowTransitionItemList()['form_id_dict']
# During rendering, this variable has been set into the request
# Render what user selected
action = request.get("mass_workflow_action", "")
if action:
return form_id_dict.get(action, '')
# Validate only if user didn't change the possible action
action = request.get("field_your_mass_workflow_action", "")
if (action and action == request.get("field_your_previous_mass_workflow_action", "")):
return form_id_dict.get(action, '')
return ''
portal_object = portal = context.getPortalObject()
module = portal.foo_module
i = 0
while i < 80000:
module.newContent(portal_type='Foo', title='test %i' % i)
i += 1
return 'couscous'
raise NotImplementedError(context.REQUEST)
return '%s %s %s %s' % (portal.portal_url(), portal.absolute_url(), portal.absolute_url_path(), context.REQUEST.physicalPathToURL(portal.getPhysicalPath() + ("",)))
return portal_object.portal_preferences.getPreference('preferred_foo_use', None)
domain_tool = portal_object.portal_domains
base_domain = domain_tool.foo_domain
url_domain = portal_object.portal_url
def generateRecur(domain, depth, result_list):
if depth:
result_list.append(('/'.join(url_domain.getRelativeContentPath(domain)[2:]), domain.getTitle()))
new_depth = depth + 1
for sub_domain in domain_tool.getChildDomainValueList(domain, depth=depth):
generateRecur(sub_domain, new_depth, result_list)
value_list = []
generateRecur(base_domain, 0, value_list)
print value_list
value_list = []
print value_list
return printed
def getDomainSelection(domain_list):
root_dict = {}
if len(domain_list) > 0:
category_tool = portal.portal_categories
domain_tool = portal.portal_domains
preference_tool = portal.portal_preferences
for base_domain_id in domain_list:
domain = None
if category_tool is not None:
domain = category_tool.restrictedTraverse(base_domain_id, None)
if domain is not None :
root_dict[base_domain_id] = getattr(
domain,
preference_tool.getPreference(
'preferred_category_child_item_list_method_id',
'getCategoryChildCompactLogicalPathItemList'
)
)(local_sort_id=('int_index', 'translated_title'), checked_permission='View',
filter_node=0, display_none_category=0)
elif domain_tool is not None:
try:
domain = domain_tool.getDomainByPath(base_domain_id, None)
except KeyError:
domain = None
if domain is not None:
# XXX Implement recursive fetch
root_dict[base_domain_id] = [(x.getTitle(), x.getId()) for x in domain_tool.getChildDomainValueList(domain, depth=0)]
return root_dict
return getDomainSelection(['foo_domain'])
return portal_object.portal_catalog(selection_domain={'region': 'france'}, src__=1)
return portal_object.portal_catalog(selection_domain={'region': portal_object.portal_categories.region.france}, src__=1)
domain = portal_object.portal_domains.getDomainByPath('validated_project_domain')
sql_catalog = portal_object.portal_catalog.getSQLCatalog()
return portal_object.portal_catalog(src__=1, full_text='title:"nutnut" AND validated_project_domain:"sub1" AND selection_domain:"region:france"')
query_kw = dict(selection_domain={
'validated_project_domain': domain.getChildDomainValueList(domain, depth=0)[0],
'region': portal_object.portal_categories.region.france
})
return sql_catalog.buildQuery(query_kw).asSearchTextExpression(sql_catalog)
return portal_object.portal_catalog(src__=1, **query_kw)
return portal_object.portal_catalog(selection_domain={'region': portal_object.portal_categories.region.france}, src__=1)
from Products.ERP5Form.Selection import Selection, DomainSelection
def getDomainSelection(self, domain_list):
"""Return a DomainSelection object wrapped with the context.
"""
portal_object = self.getPortalObject()
root_dict = {}
if len(domain_list) > 0:
category_tool = portal_object.portal_categories
domain_tool = portal_object.portal_domains
preference_tool = portal_object.portal_preferences
for domain in domain_list:
root = None
base_domain = domain.split('/', 1)[0]
if category_tool is not None:
root = category_tool.restrictedTraverse(domain, None)
if root is not None :
root_dict[base_domain] = getattr(
root,
preference_tool.getPreference(
'preferred_category_child_item_list_method_id',
'getCategoryChildCompactLogicalPathItemList'
)
)(local_sort_id=('int_index', 'translated_title'), checked_permission='View',
filter_node=0, display_none_category=0)
elif domain_tool is not None:
try:
root = domain_tool.getDomainByPath(domain, None)
except KeyError:
root = None
if root is not None:
root_dict[base_domain] = [(x.getTitle(), x.getId()) for x in root.getChildDomainValueList(root, depth=0)]
if root is None:
root = portal_object.restrictedTraverse(domain, None)
if root is not None:
root_dict[None] = (None, domain)
return root_dict
# return DomainSelection(domain_dict = root_dict)#.__of__(self.getContext())
return getDomainSelection(context, ['parent', 'region', 'validated_project_domain', 'preferred_group_person_list_domain', 'ledger'])#.asDomainItemDict(portal=context.getPortalObject())
return context.getPortalObject().TaskModule_viewTaskList.listbox.getDomainSelection()
# from Products.ERP5Form.Tool.SelectionTool import makeTreeList
# return makeTreeList()
# return context.getPortalObject().portal_selections.
return context.getPortalObject().portal_catalog(selection_domain={'group': context}, src__=1)
return "couscous"
context.setContentType(None)
context.edit(content_type=None)
# delete content.content_type
return "ok"
# Example code:
# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
response = request.response
# Return a string identifying this script.
print "This is the", script.meta_type, '"%s"' % script.getId(),
if script.title:
print "(%s)" % html_quote(script.title),
print "in", container.absolute_url()
return printed
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testromain</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_web_renderjs_ui
erp5_upgrader
\ No newline at end of file
extension.erp5.test_kaz
extension.erp5.testrc
\ No newline at end of file
1
\ No newline at end of file
image_module/romain_wallpaper_*
\ No newline at end of file
image_module/romain_wallpaper_*
\ No newline at end of file
image_module/romain_wallpaper_*
\ No newline at end of file
romain_dev
\ No newline at end of file
romain_dev
\ No newline at end of file
0.1
\ 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