[Erp5-report] r16574 - /erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Sep 24 14:28:54 CEST 2007


Author: vincent
Date: Mon Sep 24 14:28:54 2007
New Revision: 16574

URL: http://svn.erp5.org?rev=16574&view=rev
Log:
Add a method to grab cookie value by its name. An application example is to grab apache's mod_proxy_balance cookie to help locating the zope which caused an error in a zeo cluster.

Modified:
    erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py

Modified: erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py?rev=16574&r1=16573&r2=16574&view=diff
==============================================================================
--- erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py (original)
+++ erp5/trunk/utils/erp5mechanize/ERP5Mechanize.py Mon Sep 24 14:28:54 2007
@@ -66,6 +66,17 @@
     """
     return self.last_page
 
+  def getCookie(self, name, default=None):
+    """
+      XXX: It should be possible to access the cookie jar without escalating
+      a pseudo-private property of browser.
+    """
+    jar = self.browser._ua_handlers['_cookies'].cookiejar
+    for cookie in jar:
+      if name == cookie.name:
+        return cookie.value
+    return default
+
   def getPortalStatusMessage(self):
     """
       Parses the last received page and returns the value of the portal_status_message, or None if not present.




More information about the Erp5-report mailing list