Ticket #1115 (reopened enhancement)

Opened 2 years ago

Last modified 2 months ago

[PATCH] paginate.py SA support, better sorting and bug fix for compund widgets

Reported by: randall@tnr.cc Assigned to: alberto
Priority: normal Milestone: 1.5
Component: SQLAlchemy Version: 0.9a5
Severity: normal Keywords:
Cc:

Description (Last modified by faide)

Included is a patch for paginate.py which does the following thing:

1. Fix problem with form submission from compound widget. 2. Add support for SQLAlchemy using SelectResults? in sqlalchemy.ext.selectresults 3. Add multi-field sorting so that all fields are sorted in reverse of the order chosen.

This is based on this discussion:

http://groups.google.com/group/turbogears/browse_thread/thread/834a0e04ac9425a5

Attachments

paginate.py.diff.1 (10.6 kB) - added by randall@tnr.cc on 09/15/06 14:43:38.
patch for paginate.py
paginate.py.diff.2 (10.8 kB) - added by randall@tnr.cc on 09/18/06 16:21:14.
fixes sorting bug and clean up log.info entries
paginate.py.diff.3 (10.7 kB) - added by randall@tnr.cc on 09/18/06 16:26:50.
API fix for reverse_order
paginate.py.diff.4 (10.9 kB) - added by randall@tnr.cc on 09/19/06 23:20:21.
adds compatibility for tg.paginate.reversed attribute
paginate.py.diff.5 (11.2 kB) - added by randall@tnr.cc on 09/21/06 14:40:26.
fix issue with no default order specified
paginate.py.diff.6 (11.1 kB) - added by sbr77 on 10/24/06 11:37:47.
better form data fix
paginate.py.diff.1a (1.2 kB) - added by sbr77 on 11/02/06 14:47:43.
patch to fix form data only (no SA or sorting changes)
paginate.py.diff.7 (11.2 kB) - added by guest on 01/18/07 12:50:32.
new patch to work with current 1.0 branch
paginate.py.diff.8 (507 bytes) - added by vhata on 10/18/07 07:11:47.
paginate.py.diff.9 (1.4 kB) - added by vhata on 10/18/07 08:55:41.

Change History

09/15/06 14:43:38 changed by randall@tnr.cc

  • attachment paginate.py.diff.1 added.

patch for paginate.py

09/18/06 16:21:14 changed by randall@tnr.cc

  • attachment paginate.py.diff.2 added.

fixes sorting bug and clean up log.info entries

09/18/06 16:26:50 changed by randall@tnr.cc

  • attachment paginate.py.diff.3 added.

API fix for reverse_order

09/19/06 23:20:21 changed by randall@tnr.cc

  • attachment paginate.py.diff.4 added.

adds compatibility for tg.paginate.reversed attribute

09/21/06 14:40:26 changed by randall@tnr.cc

  • attachment paginate.py.diff.5 added.

fix issue with no default order specified

09/23/06 20:03:55 changed by jorge.vargas

  • summary changed from paginate.py SA support, better sorting and bug fix for compund widgets to [PATCH] paginate.py SA support, better sorting and bug fix for compund widgets.
  • component changed from TurboGears to SQLAlchemy.
  • milestone set to 1.0b2.

10/24/06 11:37:47 changed by sbr77

  • attachment paginate.py.diff.6 added.

better form data fix

11/02/06 14:47:43 changed by sbr77

  • attachment paginate.py.diff.1a added.

patch to fix form data only (no SA or sorting changes)

11/02/06 14:55:38 changed by sbr77

paginate.py.diff.1a is a very simple patch that just fixes the form data submission issues. No SA support or multi-field ordering. If you're just having trouble with forms, this is the patch I recommend because it is so simple. Otherwise use patch 6 (as of today).

12/12/06 08:04:09 changed by sanjay

Feedback - after applying paginate.py.diff.6 to my 1.0b2 installation, @paginate with sqlalchemy works nicely for me.

12/22/06 17:11:53 changed by alberto

A short unittest for this would be nice so we make sure we don't get regressions when fixing other things. I'll try to write one as soon as I have a chance but if someone who is using this can contribute one before I do it will probably get comitted sooner :)

Alberto

12/27/06 12:22:38 changed by guest

01/11/07 14:52:48 changed by alberto

  • milestone changed from 1.0b2 to 1.1.

01/12/07 03:08:44 changed by alberto

  • milestone changed from 1.1 to 1.0.1.

01/13/07 05:03:04 changed by alberto

  • owner changed from anonymous to alberto.
  • status changed from new to assigned.

01/15/07 06:11:04 changed by alberto

  • summary changed from [PATCH] paginate.py SA support, better sorting and bug fix for compund widgets to paginate.py SA support, better sorting and bug fix for compund widgets.

paginate.py.diff.g no longer applies cleanly. I get:

(Turbogears)jal:~/src/python/checkouts/turbogears/turbogears alberto$ patch -p0 < ~/Desktop/paginate.py.diff.6 
patching file paginate.py
Hunk #2 FAILED at 4.
Hunk #3 succeeded at 30 (offset 3 lines).
Hunk #4 succeeded at 55 (offset 3 lines).
Hunk #5 succeeded at 99 (offset 3 lines).
Hunk #6 succeeded at 134 (offset 3 lines).
Hunk #7 succeeded at 183 (offset 3 lines).
Hunk #8 succeeded at 218 (offset 3 lines).
1 out of 8 hunks FAILED -- saving rejects to file paginate.py.rej

Can someone please update it? Removing [PATCH] for the meantime.

Alberto

BTW: please run svn diff > ma_patch.diff from the *root* of your svn checkout to get an unified diff that's easier to apply.

TODO: Explain this somewhere to ease the job of future contributors...

01/18/07 12:13:21 changed by alberto

  • owner deleted.
  • status changed from assigned to new.

01/18/07 12:31:23 changed by guest

Kevin made this change:

r2326 | kevin | 2007-01-02 09:02:15 -0600 (Tue, 02 Jan 2007) | 2 lines

makes SQLObject optional

It's very minor. I'll create a new patch.

-Randall

01/18/07 12:50:32 changed by guest

  • attachment paginate.py.diff.7 added.

new patch to work with current 1.0 branch

01/18/07 16:08:39 changed by alberto

  • owner set to alberto.
  • status changed from new to assigned.
  • summary changed from paginate.py SA support, better sorting and bug fix for compund widgets to [PATCH] paginate.py SA support, better sorting and bug fix for compund widgets.

01/19/07 11:13:16 changed by alberto

  • status changed from assigned to closed.
  • resolution set to fixed.

Comitted at [2404]. Thanks! :)

Alberto

10/18/07 07:10:56 changed by vhata

  • status changed from closed to reopened.
  • resolution deleted.

There's a slight bug in sorting: the tg_paginate_order parameter does not get taken into account. The fix is as follows:

elif default_order and not ordering:

ordering = {default_order:[0, not default_reversed]}

- elif ordering and order: + if ordering and order:

sort_ordering(ordering, order)

log.debug('ordering %s' % ordering)

Patch attached.

10/18/07 07:11:47 changed by vhata

  • attachment paginate.py.diff.8 added.

10/18/07 08:55:41 changed by vhata

  • attachment paginate.py.diff.9 added.

10/18/07 08:56:59 changed by vhata

In addition, the tg_paginate_reversed parameter (documented at http://docs.turbogears.org/1.0/PaginateDecorator ) does not appear to be used at all.

I've attached a patch which adds this functionality, although it could probably be done more elegantly?

11/25/07 17:09:21 changed by faide

  • milestone changed from 1.0.1 to 1.1.

06/06/08 02:11:52 changed by faide

  • description changed.
  • milestone changed from 1.1 to 1.1.1.

08/24/08 10:27:19 changed by faide

  • milestone changed from 1.6 to 1.5.