diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/Base_activateSimpleView.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/Base_activateSimpleView.xml index f42bad6dd060b3edcc8898044c17750928ba1012..be7f1c884ac5d24660ebdd31d54fbc271db5c7ba 100644 --- a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/Base_activateSimpleView.xml +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/Base_activateSimpleView.xml @@ -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 diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml index ca74939b67dc0f0b9f603190787bc462f3dae516..c25419b95aec82c58a5de7bcc1afb755b20fa06d 100644 --- a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml @@ -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 diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_computeReportSection.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_computeReportSection.xml new file mode 100644 index 0000000000000000000000000000000000000000..241fed05158862cb5ca4af855637e7b989bfebf2 --- /dev/null +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_computeReportSection.xml @@ -0,0 +1,139 @@ +<?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> diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.xml index 617ca675168476ee9f73cae2bc893b0c06232df2..1966730204818a369deb4c9699891f8a8d5392da 100644 --- a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.xml +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_renderSimpleView.xml @@ -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 diff --git a/bt5/erp5_deferred_style/bt/revision b/bt5/erp5_deferred_style/bt/revision index 0fd0714a51f10639eab0e6a0121977179a7b458a..e55677ae8d2a4fe56e78c3220352280e887848ea 100644 --- a/bt5/erp5_deferred_style/bt/revision +++ b/bt5/erp5_deferred_style/bt/revision @@ -1 +1,2 @@ -103 \ No newline at end of file +108 +