[python-mechanize] - Update to 0.2.4 - Include a missed cgi script and add python-zope-interface and python-twisted-w
cheeselee
cheeselee at fedoraproject.org
Tue Jan 4 04:15:47 UTC 2011
commit 5803139cedd999d84e065f61fac6627f0cab316a
Author: Robin Lee <cheeselee at fedoraproject.org>
Date: Tue Jan 4 12:16:12 2011 +0800
- Update to 0.2.4
- Include a missed cgi script and add python-zope-interface and
python-twisted-web2 to BR to run extra tests
- Remove executable bits from example scripts
.gitignore | 1 +
cookietest.cgi | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
python-mechanize.spec | 20 ++++++++++++++-
sources | 2 +-
4 files changed, 81 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 63cee7e..75fe1c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
mechanize-0.1.10.tar.gz
/mechanize-0.2.2.tar.gz
mechanize-0.2.3.tar.gz
+/mechanize-0.2.4.tar.gz
diff --git a/cookietest.cgi b/cookietest.cgi
new file mode 100644
index 0000000..468682f
--- /dev/null
+++ b/cookietest.cgi
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+# -*-python-*-
+
+# This is used by functional_tests.py
+
+#import cgitb; cgitb.enable()
+
+import time
+
+print "Content-Type: text/html"
+year_plus_one = time.localtime(time.time())[0] + 1
+expires = "expires=09-Nov-%d 23:12:40 GMT" % (year_plus_one,)
+print "Set-Cookie: foo=bar; %s" % expires
+print "Set-Cookie: sessioncookie=spam\n"
+import sys, os, string, cgi, Cookie, urllib
+from xml.sax import saxutils
+
+from types import ListType
+
+print "<html><head><title>Cookies and form submission parameters</title>"
+cookie = Cookie.SimpleCookie()
+cookieHdr = os.environ.get("HTTP_COOKIE", "")
+cookie.load(cookieHdr)
+form = cgi.FieldStorage()
+refresh_value = None
+if form.has_key("refresh"):
+ refresh = form["refresh"]
+ if not isinstance(refresh, ListType):
+ refresh_value = refresh.value
+if refresh_value is not None:
+ print '<meta http-equiv="refresh" content=%s>' % (
+ saxutils.quoteattr(urllib.unquote_plus(refresh_value)))
+elif not cookie.has_key("foo"):
+ print '<meta http-equiv="refresh" content="5">'
+
+print "</head>"
+print "<p>Received cookies:</p>"
+print "<pre>"
+print cgi.escape(os.environ.get("HTTP_COOKIE", ""))
+print "</pre>"
+if cookie.has_key("foo"):
+ print "<p>Your browser supports cookies!"
+if cookie.has_key("sessioncookie"):
+ print "<p>Received session cookie"
+print "<p>Referer:</p>"
+print "<pre>"
+print cgi.escape(os.environ.get("HTTP_REFERER", ""))
+print "</pre>"
+print "<p>Received parameters:</p>"
+print "<pre>"
+for k in form.keys():
+ v = form[k]
+ if isinstance(v, ListType):
+ vs = []
+ for item in v:
+ vs.append(item.value)
+ text = string.join(vs, ", ")
+ else:
+ text = v.value
+ print "%s: %s" % (cgi.escape(k), cgi.escape(text))
+print "</pre></html>"
diff --git a/python-mechanize.spec b/python-mechanize.spec
index 84d7564..10988f9 100644
--- a/python-mechanize.spec
+++ b/python-mechanize.spec
@@ -1,7 +1,7 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: python-mechanize
-Version: 0.2.3
+Version: 0.2.4
Release: 1%{?dist}
Summary: Stateful programmatic web browsing
@@ -9,10 +9,16 @@ Group: System Environment/Libraries
License: BSD or ZPLv2.1
URL: http://wwwsearch.sourceforge.net/mechanize
Source0: http://wwwsearch.sourceforge.net/mechanize/src/mechanize-%{version}.tar.gz
+# missed cgi script for the tests
+# https://github.com/jjlee/mechanize/raw/master/test-tools/cookietest.cgi
+# https://github.com/jjlee/mechanize/issues/#issue/34
+Source1: cookietest.cgi
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel
+# for tests
+BuildRequires: python-zope-interface python-twisted-web2
%if 0%{?fedora} >= 8
BuildRequires: python-setuptools-devel
%else
@@ -40,6 +46,8 @@ Andy Lester (WWW::Mechanize). urllib2 was written by Jeremy Hylton.
%prep
%setup -q -n mechanize-%{version}
+chmod -x examples/forms/{echo.cgi,example.py,simple.py}
+install -pm 0755 %{SOURCE1} test-tools/
%build
@@ -56,7 +64,9 @@ rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT
%check
-%{__python} test.py
+chmod +x examples/forms/{echo.cgi,example.py,simple.py}
+%{__python} test.py --log-server
+chmod -x examples/forms/{echo.cgi,example.py,simple.py}
%files
%defattr(-,root,root,-)
@@ -65,6 +75,12 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Tue Jan 4 2011 Robin Lee <cheeselee at fedoraproject.org> - 0.2.4-1
+- Update to 0.2.4
+- Include a missed cgi script and add python-zope-interface and
+ python-twisted-web2 to BR to run extra tests
+- Remove executable bits from example scripts
+
* Thu Oct 21 2010 Luke Macken <lmacken at redhat.com> - 0.2.3-1
- Update to 0.2.3 (#3645064)
diff --git a/sources b/sources
index b568354..095bd25 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-3a2e803cf1c7e68e172a62db1ad088a2 mechanize-0.2.3.tar.gz
+0c1c3cec1c6d7b5d87662a069f04eb8d mechanize-0.2.4.tar.gz
More information about the scm-commits
mailing list