rpms/python-turbojson/devel turbojson-result-row-proxy.patch, NONE, 1.1 python-turbojson.spec, 1.16, 1.17

Toshio くらとみ toshio at fedoraproject.org
Mon Feb 8 20:40:13 UTC 2010


Author: toshio

Update of /cvs/pkgs/rpms/python-turbojson/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20965/devel

Modified Files:
	python-turbojson.spec 
Added Files:
	turbojson-result-row-proxy.patch 
Log Message:

* Mon Feb 8 2010 Toshio Kuratomi <toshio at fedoraproject.org> - 1.2.1-9
- Add patch to fix SA RowProxy and ResultProxy
- Update BR for setuptools and defining python_sitelib
- Trim changelog


turbojson-result-row-proxy.patch:
 jsonify.py               |   10 ++++++++++
 tests/test_sqlalchemy.py |   13 +++++++++++++
 2 files changed, 23 insertions(+)

--- NEW FILE turbojson-result-row-proxy.patch ---
Index: turbojson/jsonify.py
===================================================================
--- turbojson.orig/jsonify.py
+++ turbojson/jsonify.py
@@ -144,6 +144,16 @@ try:
                 """JSONify SQLAlchemy instrumented lists."""
                 return list(obj)
 
+    from sqlalchemy.engine.base import ResultProxy, RowProxy
+
+    @jsonify.when("isinstance(obj, ResultProxy)", prio=-1)
+    def jsonify_saproxy(obj):
+        return list(obj)
+
+    @jsonify.when("isinstance(obj, RowProxy)", prio=-1)
+    def jsonify_saproxy(obj):
+        return dict(obj)
+
 except ImportError:
     pass
 
Index: turbojson/tests/test_sqlalchemy.py
===================================================================
--- turbojson.orig/tests/test_sqlalchemy.py
+++ turbojson/tests/test_sqlalchemy.py
@@ -70,6 +70,19 @@ else:
         assert encoded == '[{"test1id": 1, "id": 1, "val": "fred"},' \
             ' {"test1id": 1, "id": 2, "val": "alice"}]'
 
+    def test_select_row():
+        s = create_session()
+        t = test1.select().execute()
+        encoded = jsonify.encode(t)
+        assert encoded == '[{"id": 1, "val": "bob"}]'
+
+    def test_select_rows():
+        s = create_session()
+        t = test2.select().execute()
+        encoded = jsonify.encode(t)
+        assert encoded == '[{"test1id": 1, "id": 1, "val": "fred"},' \
+            ' {"test1id": 1, "id": 2, "val": "alice"}]'
+
     def test_explicit_saobj():
         s = create_session()
         t = s.query(Test3).get(1)


Index: python-turbojson.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-turbojson/devel/python-turbojson.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -r1.16 -r1.17
--- python-turbojson.spec	27 Jul 2009 01:19:01 -0000	1.16
+++ python-turbojson.spec	8 Feb 2010 20:40:13 -0000	1.17
@@ -1,22 +1,29 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
+%if !(0%{?fedora} > 12 || 0%{?rhel} >= 6)
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%endif
 
-%define module turbojson
+%global module turbojson
 
 Name:           python-turbojson
 Version:        1.2.1
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        Python template plugin that supports json
 
 Group:          Development/Languages
 License:        MIT
 URL:            http://cheeseshop.python.org/pypi/TurboJson
 Source0:        http://pypi.python.org/packages/source/T/TurboJson/TurboJson-%{version}.tar.gz
+# Backport of fix for SA RowProxy and ResultProxy from trunk
+Patch0: turbojson-result-row-proxy.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 
 BuildRequires: python-devel
+%if 0%{?fedora} && 0%{?fedora} < 12
 BuildRequires: python-setuptools-devel
+%else
+BuildRequires: python-setuptools
+%endif
 BuildRequires: python-prioritized-methods > 0.2
 BuildRequires: python-peak-rules >= 0.5a1.dev-0.2555
 BuildRequires: python-simplejson >= 1.9.1
@@ -34,6 +41,7 @@ that support python.templating.engines.
 
 %prep
 %setup -q -n TurboJson-%{version}
+%patch0 -p0 -b .sa
 
 %build
 %{__python} setup.py build
@@ -53,10 +61,15 @@ rm -rf %{buildroot}
 %files
 %defattr(-,root,root,-)
 %{python_sitelib}/%{module}/
-%{python_sitelib}/TurboJson-%{version}-py%{pyver}.egg-info/
+%{python_sitelib}/*.egg-info/
 
 
 %changelog
+* Mon Feb 8 2010 Toshio Kuratomi <toshio at fedoraproject.org> - 1.2.1-9
+- Add patch to fix SA RowProxy and ResultProxy
+- Update BR for setuptools and defining python_sitelib
+- Trim changelog
+
 * Sun Jul 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.1-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 
@@ -102,18 +115,3 @@ rm -rf %{buildroot}
 * Wed Oct  3 2007 Luke Macken <lmacken at redhat.com> 1.1-1
 - 1.1
 - Update URL and Source
-
-* Fri Dec  8 2006 Luke Macken <lmacken at redhat.com> 0.9.9-3
-- Rebuild for new python
-
-* Fri Oct  6 2006 Luke Macken <lmacken at redhat.com> 0.9.9-2
-- Update source url
-
-* Mon Sep 25 2006 Luke Macken <lmacken at redhat.com> 0.9.9-1
-- 0.9.9
-- Rename to python-turbojson
-- Own the %%{python_sitelib/turbojson directory
-- Install the EGG-INFO
-
-* Sat Sep 16 2006 Luke Macken <lmacken at redhat.com> 0.9.8-1
-- Initial creation



More information about the scm-commits mailing list