[Erp5-report] r11454 - /erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 23 10:51:34 CET 2006


Author: vincent
Date: Thu Nov 23 10:51:33 2006
New Revision: 11454

URL: http://svn.erp5.org?rev=11454&view=rev
Log:
Initial import of the python script used to diff objects from inside the ZODB.

Added:
    erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/diff.xml

Added: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/diff.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/diff.xml?rev=11454&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/diff.xml (added)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/diff.xml Thu Nov 23 10:51:33 2006
@@ -1,0 +1,216 @@
+<?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 encoding="cdata"><![CDATA[
+
+kw.update(context.REQUEST.form)\n
+\n
+def getObjectFromArg(argument):\n
+  """\n
+    Return an object identified by argument.\n
+    If argument is a string, assume it\'s the path to the object.\n
+    Otherwise, assume it\'s the object itself.\n
+  """\n
+  if isinstance(argument, str):\n
+    return context.restrictedTraverse(argument)\n
+  return argument\n
+\n
+kw_value_list = kw.values()\n
+kw_len = len(kw_value_list)\n
+if kw_len == 1:\n
+  object_a = context\n
+  object_b = getObjectFromArg(kw_value_list[0])\n
+elif kw_len == 2:\n
+  kw_value_list = kw.values()\n
+  object_a = getObjectFromArg(kw_value_list[0])\n
+  object_b = getObjectFromArg(kw_value_list[1])\n
+else:\n
+  raise ValueError, \'%s is not a valid number of arguments for diff.\' % (kw_len, )\n
+\n
+diff_dict, missing_in_a_dict, missing_in_b_dict = diff_recursive(object_a, object_b)\n
+\n
+context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/html;; charset=utf-8\')\n
+print \'<html>\'\n
+print \'<head><title>Diff between %s and %s</title></head>\' % (object_a.id, object_b.id)\n
+print \'<body><pre>\'\n
+print \'--- <a href="%s">%s</a>\' % (object_a.absolute_url(), object_a.id)\n
+print \'+++ <a href="%s">%s</a>\' % (object_b.absolute_url(), object_b.id)\n
+print \'</pre><h1>Modified files</h1><ul>\'\n
+for id, diff in diff_dict.items():\n
+  print \'<li><b>%s</b><pre>\' % (id, )\n
+  for line in diff:\n
+    print line\n
+  print \'</pre></li>\'\n
+print \'</ul>\'\n
+if len(missing_in_a_dict):\n
+  print \'<h1>Objects missing in first object</h1><ul>\'\n
+  for id in missing_in_a_dict.keys():\n
+    print \'<li>%s</li>\' % (id, )\n
+  print \'</ul>\'\n
+if len(missing_in_b_dict):\n
+  print \'<h1>Objects missing in second object</h1><ul>\'\n
+  for id in missing_in_b_dict.keys():\n
+    print \'<li>%s</li>\' % (id, )\n
+  print \'</ul>\'\n
+print \'</body></html>\'\n
+return printed\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>**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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>kw</string>
+                            <string>_print_</string>
+                            <string>_print</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>getObjectFromArg</string>
+                            <string>kw_value_list</string>
+                            <string>len</string>
+                            <string>kw_len</string>
+                            <string>object_a</string>
+                            <string>_getitem_</string>
+                            <string>object_b</string>
+                            <string>ValueError</string>
+                            <string>diff_recursive</string>
+                            <string>_getiter_</string>
+                            <string>diff_dict</string>
+                            <string>missing_in_a_dict</string>
+                            <string>missing_in_b_dict</string>
+                            <string>id</string>
+                            <string>diff</string>
+                            <string>line</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>diff</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