[Erp5-report] r32910 ivan - /erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Feb 22 10:06:03 CET 2010
Author: ivan
Date: Mon Feb 22 10:06:03 2010
New Revision: 32910
URL: http://svn.erp5.org?rev=32910&view=rev
Log:
Use generic contribute script.
Removed:
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml
erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml
Removed: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml?rev=32909&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_contributeContent.xml (removed)
@@ -1,255 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
- <record id="1" aka="AAAAAAAAAAE=">
- <pickle>
- <tuple>
- <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
- <tuple/>
- </tuple>
- </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>"""\n
- A method invoked with parameters provided by the \n
- contribute widget.\n
-\n
- **kw -- remaining params passed to the constructor\n
-"""\n
-from Products.ERP5.Document.Document import ConversionError\n
-from xmlrpclib import Fault\n
-from socket import error as SocketError\n
-\n
-Base_translateString = context.Base_translateString\n
-\n
-# return if no file was uploaded\n
-if contribute_file is None or contribute_file.filename in (\'\', None,):\n
- return context.Base_redirect(\'view\',\n
- keep_items = dict(\n
- portal_status_message = Base_translateString(\'No file was selected for contribution.\'), \n
- editable_mode = context.REQUEST.get(\'editable_mode\', 0)))\n
-\n
-# Do some processing of parameters cause we do not use ERP5 Form here\n
-if contribute_classification:\n
- kw[\'classification\'] = contribute_classification\n
-\n
-if contribute_source_project:\n
- kw[\'follow_up\'] = contribute_source_project\n
-\n
-if contribute_portal_type:\n
- kw[\'portal_type\'] = contribute_portal_type\n
-\n
-if contribute_file is not None:\n
- kw[\'file\'] = contribute_file\n
-\n
-# We want to discover metadata synchronously\n
-kw[\'discover_metadata\'] = 0\n
-\n
-editable_mode = 1\n
-file_name = getattr(contribute_file, \'filename\', None)\n
-# try to ingest file\n
-failure = 0\n
-new_content = None\n
-merged_content = None\n
-\n
-try:\n
- new_content = context.portal_contributions.newContent(**kw)\n
- new_content.processFile()\n
- merged_content = new_content.Document_convertToBaseFormatAndDiscoverMetadata(file_name=file_name)\n
-\n
-except ConversionError, Fault:\n
- # there are errors during ingestion content\n
- failure = 1\n
- msg = \'Sorry, there was a problem during conversion of your document.\'\n
-except SocketError:\n
- # conversion server is down\n
- failure = 1\n
- msg = \'Sorry, the conversion server is down. Please try again later.\'\n
-except (TypeError, KeyError, AttributeError):\n
- # there\'s an unknow error occured\n
- failure = 1\n
- msg = \'Sorry, unknow error occured.\'\n
-\n
-target = None\n
-if merged_content is not None:\n
- target = merged_content\n
-elif new_content is not None:\n
- target = new_content\n
-else:\n
- target = context\n
-\n
-if failure:\n
- msg = Base_translateString(msg)\n
- return target.Base_redirect(\'view\',\n
- keep_items=dict(portal_status_message=msg,\n
- editable_mode=0))\n
-# successful ingestion, show appropriate message\n
-if merged_content is not None and merged_content is not new_content:\n
- msg = Base_translateString(\'Document successfully updated.\')\n
- target = merged_content\n
-else:\n
- msg = Base_translateString(\'Document successfully created.\')\n
- target = new_content\n
-\n
-# Change acquisition context of document, in order to get web section layout\n
-target = context.restrictedTraverse(target.getRelativeUrl())\n
-target_request = target.REQUEST\n
-target_request.set(\'editable_mode\', editable_mode)\n
-target_request.set(\'portal_status_message\', msg)\n
-# clean up REQUEST as it is possible that this script is called\n
-# on an another Document in an edit view (then fields will be passed in REQUEST \n
-# overriding next form HTML generation in \'target.view()\' )\n
-for key in target_request.form.keys():\n
- if key.startswith(\'field_my_\'):\n
- del target_request.form[key]\n
-return target.view()\n
-\n
-# XXX Do not use redirect, as it leeds to conflict error with convertion process\n
-# return target.Base_redirect(\'view\',\n
-# keep_items=dict(portal_status_message=msg, \n
-# editable_mode=editable_mode))\n
-</string> </value>
- </item>
- <item>
- <key> <string>_code</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>_params</string> </key>
- <value> <string>contribute_file=None, contribute_classification=None, contribute_source_project=None, contribute_portal_type=None, **kw</string> </value>
- </item>
- <item>
- <key> <string>errors</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- <item>
- <key> <string>func_code</string> </key>
- <value>
- <object>
- <klass>
- <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
- </klass>
- <tuple/>
- <state>
- <dictionary>
- <item>
- <key> <string>co_argcount</string> </key>
- <value> <int>4</int> </value>
- </item>
- <item>
- <key> <string>co_varnames</string> </key>
- <value>
- <tuple>
- <string>contribute_file</string>
- <string>contribute_classification</string>
- <string>contribute_source_project</string>
- <string>contribute_portal_type</string>
- <string>kw</string>
- <string>Products.ERP5.Document.Document</string>
- <string>ConversionError</string>
- <string>xmlrpclib</string>
- <string>Fault</string>
- <string>socket</string>
- <string>error</string>
- <string>SocketError</string>
- <string>_getattr_</string>
- <string>context</string>
- <string>Base_translateString</string>
- <string>None</string>
- <string>dict</string>
- <string>_write_</string>
- <string>editable_mode</string>
- <string>getattr</string>
- <string>file_name</string>
- <string>failure</string>
- <string>new_content</string>
- <string>merged_content</string>
- <string>_apply_</string>
- <string>msg</string>
- <string>TypeError</string>
- <string>KeyError</string>
- <string>AttributeError</string>
- <string>target</string>
- <string>target_request</string>
- <string>_getiter_</string>
- <string>key</string>
- </tuple>
- </value>
- </item>
- </dictionary>
- </state>
- </object>
- </value>
- </item>
- <item>
- <key> <string>func_defaults</string> </key>
- <value>
- <tuple>
- <none/>
- <none/>
- <none/>
- <none/>
- </tuple>
- </value>
- </item>
- <item>
- <key> <string>id</string> </key>
- <value> <string>WebSite_contributeContent</string> </value>
- </item>
- <item>
- <key> <string>warnings</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- </dictionary>
- </pickle>
- </record>
-</ZopeData>
Removed: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml?rev=32909&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSite_linkContent.xml (removed)
@@ -1,175 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
- <record id="1" aka="AAAAAAAAAAE=">
- <pickle>
- <tuple>
- <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
- <tuple/>
- </tuple>
- </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># Do some processing of parameters cause we do not use ERP5 Form here\n
-if link_classification:\n
- kw[\'classification\'] = link_classification\n
-\n
-if link_source_project:\n
- kw[\'source_project\'] = link_source_project\n
-\n
-if link_portal_type:\n
- kw[\'portal_type\'] = link_portal_type\n
-\n
-if link_description:\n
- kw[\'description\'] = link_description\n
-\n
-if link_url:\n
- kw[\'url\'] = link_url\n
-\n
-kw[\'discover_metadata\'] = 0 # We want to discover metadata synchronously\n
-\n
-#try:\n
-if 1:\n
- new_content = context.portal_contributions.newContent(**kw)\n
- new_content.discoverMetadata() # Consider putting an exception handler\n
- msg = context.Base_translateString(\'Document successfully created.\')\n
- target = new_content\n
- editable_mode = 1\n
-else:\n
-#except Exception, e:\n
- msg = \'There was a problem: ${exception}\'\n
- msg = context.Base_translateString(msg, mapping=dict(exception=str(e)))\n
- target = context\n
- editable_mode = 0\n
-\n
-return target.Base_redirect(\'view\', keep_items=dict(portal_status_message=msg, editable_mode=editable_mode))\n
-</string> </value>
- </item>
- <item>
- <key> <string>_code</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>_params</string> </key>
- <value> <string>link_url=None, link_description=None, link_classification=None, link_source_project=None, link_portal_type=None, **kw</string> </value>
- </item>
- <item>
- <key> <string>errors</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- <item>
- <key> <string>func_code</string> </key>
- <value>
- <object>
- <klass>
- <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
- </klass>
- <tuple/>
- <state>
- <dictionary>
- <item>
- <key> <string>co_argcount</string> </key>
- <value> <int>5</int> </value>
- </item>
- <item>
- <key> <string>co_varnames</string> </key>
- <value>
- <tuple>
- <string>link_url</string>
- <string>link_description</string>
- <string>link_classification</string>
- <string>link_source_project</string>
- <string>link_portal_type</string>
- <string>kw</string>
- <string>_write_</string>
- <string>_apply_</string>
- <string>_getattr_</string>
- <string>context</string>
- <string>new_content</string>
- <string>msg</string>
- <string>target</string>
- <string>editable_mode</string>
- <string>dict</string>
- <string>str</string>
- <string>e</string>
- </tuple>
- </value>
- </item>
- </dictionary>
- </state>
- </object>
- </value>
- </item>
- <item>
- <key> <string>func_defaults</string> </key>
- <value>
- <tuple>
- <none/>
- <none/>
- <none/>
- <none/>
- <none/>
- </tuple>
- </value>
- </item>
- <item>
- <key> <string>id</string> </key>
- <value> <string>WebSite_linkContent</string> </value>
- </item>
- <item>
- <key> <string>warnings</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- </dictionary>
- </pickle>
- </record>
-</ZopeData>
More information about the Erp5-report
mailing list