Commit 24905f77 authored by Aurel's avatar Aurel

render report section in activity as this can be quite long

Conflicts:
	bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.xml
	bt5/erp5_deferred_style/bt/revision
parent e7e070b9
......@@ -83,7 +83,7 @@ for k, v in request.form.items():\n
\'PUBLISHED\', \'AcceptLanguage\', \'AcceptCharset\', \'RESPONSE\',\n
\'ACTUAL_URL\'):\n
# XXX proxy fields stores a cache in request.other that cannot be pickled\n
if k.startswith(\'field__proxyfield\'):\n
if str(k).startswith(\'field__proxyfield\'):\n
continue\n
# Remove FileUpload parameters\n
elif getattr(v, \'headers\', \'\'):\n
......
......@@ -53,9 +53,6 @@
<value> <string>request = container.REQUEST\n
RESPONSE = request.RESPONSE\n
\n
format = request.get(\'format\', \'\')\n
skin_name = request[\'deferred_portal_skin\']\n
\n
portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
......@@ -69,23 +66,13 @@ if person_value.getDefaultEmailText(\'\') in (\'\', None):\n
portal.changeSkin(None)\n
return context.Base_redirect(\'view\', keep_items=dict(\n
portal_status_message=N_("You haven\'t defined your email address")))\n
\n
active_process = portal.portal_activities.newActiveProcess()\n
user_name = person_value.getReference()\n
\n
tag = \'active-report-%s\' % random.randint(0, 1000)\n
priority = 3\n
\n
# compute list of report section to render\n
if form.meta_type == \'ERP5 Report\':\n
report_section_list = getattr(context, form.report_method)()\n
elif form.meta_type == \'ERP5 Form\':\n
report_section_list = []\n
for field in form.get_fields():\n
if field.getRecursiveTemplateField().meta_type == \'ReportBox\':\n
report_section_list.extend(field.render())\n
else:\n
raise ValueError, \'form meta_type unknown\'\n
user_name = person_value.getReference()\n
tag = \'active-report-%s\' % random.randint(0, 1000)\n
priority = 2\n
format = request.get(\'format\', \'\')\n
skin_name = request[\'deferred_portal_skin\']\n
\n
# save request parameters (after calling the report_method which may tweak the\n
# request). XXX we exclude some reserved names in a very ad hoc way\n
......@@ -96,45 +83,25 @@ for k, v in request.items():\n
\'PUBLISHED\', \'AcceptLanguage\', \'AcceptCharset\', \'RESPONSE\', \'SESSION\',\n
\'ACTUAL_URL\'):\n
# XXX proxy fields stores a cache in request.other that cannot be pickled\n
if k.startswith(\'field__proxyfield\'):\n
if same_type(k, \'\') and k.startswith(\'field__proxyfield\'):\n
continue\n
# Remove FileUpload parameters\n
elif getattr(v, \'headers\', \'\'):\n
continue\n
request_other[k] = v\n
\n
localizer_language = portal.Localizer.get_selected_language()\n
\n
for idx, report_section in enumerate(report_section_list):\n
if report_section.getPath():\n
doc = report_section.getObject(portal)\n
else:\n
doc = context\n
doc.activate(activity=\'SQLQueue\',\n
active_process=active_process,\n
tag=tag,\n
priority=priority,\n
).Base_renderReportSection(skin_name=skin_name,\n
localizer_language=localizer_language,\n
report_section=report_section,\n
report_section_idx=idx,\n
request_other=request_other)\n
\n
activity_context = context\n
if activity_context == portal:\n
# portal is not an active object\n
activity_context = portal.portal_simulation\n
\n
activity_context.activate(activity=\'SQLQueue\', after_tag=tag, priority=priority).Base_report(\n
active_process_url=active_process.getRelativeUrl(),\n
skin_name=skin_name,\n
localizer_language=localizer_language,\n
title=N_(form.getProperty(\'title\')),\n
request_other=request_other,\n
form_path=form.getPhysicalPath(),\n
user_name=user_name,\n
format=format,\n
)\n
context.activate(activity="SQLQueue", tag=tag, \n
priority=priority).Base_computeReportSection(\n
form=form.getId(), \n
request_other=request_other, \n
user_name=user_name, \n
tag=tag,\n
skin_name=skin_name, \n
format=format,\n
priority=priority, \n
**kw)\n
\n
context.activate(activity=\'SQLQueue\', after_tag=tag).getTitle()\n
\n
......
<?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>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
form = context.restrictedTraverse(form)\n
request = container.REQUEST\n
request.other.update(request_other)\n
\n
if form.meta_type == \'ERP5 Report\':\n
report_section_list = getattr(context, form.report_method)()\n
elif form.meta_type == \'ERP5 Form\':\n
report_section_list = []\n
for field in form.get_fields():\n
if field.getRecursiveTemplateField().meta_type == \'ReportBox\':\n
report_section_list.extend(field.render())\n
else:\n
raise ValueError, \'form meta_type (%r) unknown\' %(form.meta_type,)\n
\n
# Rebuild request_other as report section can have modify request content\n
request_other = dict()\n
for k, v in request.items():\n
if k not in (\'TraversalRequestNameStack\', \'AUTHENTICATED_USER\', \'URL\',\n
\'SERVER_URL\', \'AUTHENTICATION_PATH\', \'USER_PREF_LANGUAGES\', \'PARENTS\',\n
\'PUBLISHED\', \'AcceptLanguage\', \'AcceptCharset\', \'RESPONSE\', \'SESSION\',\n
\'ACTUAL_URL\'):\n
# XXX proxy fields stores a cache in request.other that cannot be pickled\n
if same_type(k, \'\') and str(k).startswith(\'field__proxyfield\'):\n
continue\n
# Remove FileUpload parameters\n
elif getattr(v, \'headers\', \'\'):\n
continue\n
request_other[k] = v\n
\n
localizer_language = portal.Localizer.get_selected_language()\n
active_process = portal.portal_activities.newActiveProcess()\n
\n
for idx, report_section in enumerate(report_section_list):\n
if report_section.getPath():\n
doc = report_section.getObject(portal)\n
else:\n
doc = context\n
doc.activate(activity=\'SQLQueue\',\n
active_process=active_process,\n
tag=tag,\n
priority=priority,\n
).Base_renderReportSection(skin_name=skin_name,\n
localizer_language=localizer_language,\n
report_section=report_section,\n
report_section_idx=idx,\n
request_other=request_other)\n
\n
activity_context = context\n
if activity_context == portal:\n
# portal is not an active object\n
activity_context = portal.portal_simulation\n
\n
activity_context.activate(activity=\'SQLQueue\', after_tag=tag, priority=priority).Base_report(\n
active_process_url=active_process.getRelativeUrl(),\n
skin_name=skin_name,\n
localizer_language=localizer_language,\n
title=N_(form.getProperty(\'title\')),\n
request_other=request_other,\n
form_path=form.getPhysicalPath(),\n
user_name=user_name,\n
format=format,\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form, request_other, user_name, tag, skin_name, format, priority, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_computeReportSection</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -76,7 +76,7 @@ attachment_list = (\n
# XXX Use notification message to improve message content\n
portal.portal_notifications.sendMessage(\n
recipient=user_name,\n
subject=attachment_name.rsplit(\'.\', 1)[0],\n
subject=str(attachment_name.rsplit(\'.\', 1)[0]),\n
message=str(translateString(\'Your report is attached.\\n\')),\n
message_text_format=\'text/plain\',\n
notifier_list=(\'Mail Message\',),\n
......
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