From f2c01f403ea5b775b6ad4e408d0657ea82b501b4 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Wed, 2 May 2007 10:19:57 +0000
Subject: [PATCH] Minor change to query objects system. Add new query creation
 script.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14295 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_base/Base_newQuery.xml  | 164 ++++++++++++++++++
 .../portal_skins/erp5_base/Base_postQuery.xml |  22 +--
 2 files changed, 173 insertions(+), 13 deletions(-)
 create mode 100644 bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_newQuery.xml

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_newQuery.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_newQuery.xml
new file mode 100644
index 0000000000..ec2fb133ee
--- /dev/null
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_newQuery.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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 script which actually creates and returns the query object.\n
+"""\n
+\n
+query_module = context.getPortalObject().query_module \n
+query = query_module.newContent(description=description, \n
+                                title=context.getPortalType(),\n
+                                agent_value=context)\n
+query.updateLocalRolesOnSecurityGroups()\n
+query.post()\n
+return query\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>description</string> </value>
+        </item>
+        <item>
+            <key> <string>_proxy_roles</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+              </tuple>
+            </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>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>description</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>query_module</string>
+                            <string>query</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_newQuery</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_postQuery.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_postQuery.xml
index 9f0f3776bb..9a7891865b 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_postQuery.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_postQuery.xml
@@ -74,22 +74,13 @@ ptype = context.getPortalType()\n
 \n
 if not description:\n
   return context.Base_redirect(dialog_id,\n
-              keep_items = dict(portal_status_message = translateString("Question can not be empty.",),\n
-                                cancel_url = cancel_url))\n
+              keep_items = dict(portal_status_message = translateString("Question can not be empty.",), cancel_url = cancel_url))\n
 \n
-query_module = context.getPortalObject().query_module \n
-query = query_module.newContent(description=description, title=context.getPortalType(),\n
-                                agent_value=context)\n
-query.updateLocalRolesOnSecurityGroups()\n
+query = context.Base_newQuery(description=description)\n
 query_id = query.getId()\n
-query.post()\n
-\n
 return context.Base_redirect(form_id,\n
               keep_items = dict(portal_status_message = translateString("A Query about the current ${portal_type} was posted with ID ${query_id}.", mapping = dict(query_id=query_id, portal_type=ptype)),\n
-                                cancel_url = cancel_url))\n
-\n
-\n
-return description\n
+              cancel_url = cancel_url))\n
 </string> </value>
         </item>
         <item>
@@ -104,6 +95,12 @@ return description\n
               <none/>
             </value>
         </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>_params</string> </key>
             <value> <string>dialog_id=None,form_id=None,description=None,cancel_url=\'\'</string> </value>
@@ -150,7 +147,6 @@ return description\n
                             <string>request</string>
                             <string>ptype</string>
                             <string>dict</string>
-                            <string>query_module</string>
                             <string>query</string>
                             <string>query_id</string>
                           </tuple>
-- 
2.30.9