Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1115 (closed enhancement: invalid)

Opened 11 years ago

Last modified 8 years ago

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

Reported by: randall@… Owned by: alberto
Priority: normal Milestone: 1.5
Component: SQLAlchemy Version: 0.9a5
Severity: normal Keywords:
Cc:

Description (last modified by faide) (diff)

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 Download (10.6 KB) - added by randall@… 11 years ago.
patch for paginate.py
paginate.py.diff.2 Download (10.8 KB) - added by randall@… 11 years ago.
fixes sorting bug and clean up log.info entries
paginate.py.diff.3 Download (10.7 KB) - added by randall@… 11 years ago.
API fix for reverse_order
paginate.py.diff.4 Download (10.9 KB) - added by randall@… 11 years ago.
adds compatibility for tg.paginate.reversed attribute
paginate.py.diff.5 Download (11.2 KB) - added by randall@… 11 years ago.
fix issue with no default order specified
paginate.py.diff.6 Download (11.1 KB) - added by sbr77 11 years ago.
better form data fix
paginate.py.diff.1a Download (1.2 KB) - added by sbr77 11 years ago.
patch to fix form data only (no SA or sorting changes)
paginate.py.diff.7 Download (11.2 KB) - added by guest 11 years ago.
new patch to work with current 1.0 branch
paginate.py.diff.8 Download (507 bytes) - added by vhata 10 years ago.
paginate.py.diff.9 Download (1.4 KB) - added by vhata 10 years ago.

Change History

Changed 11 years ago by randall@…

patch for paginate.py

Changed 11 years ago by randall@…

fixes sorting bug and clean up log.info entries

Changed 11 years ago by randall@…

API fix for reverse_order

Changed 11 years ago by randall@…

adds compatibility for tg.paginate.reversed attribute

Changed 11 years ago by randall@…

fix issue with no default order specified

comment:1 Changed 11 years ago by jorge.vargas

  • Milestone set to 1.0b2
  • Component changed from TurboGears to SQLAlchemy
  • 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

Changed 11 years ago by sbr77

better form data fix

Changed 11 years ago by sbr77

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

comment:2 Changed 11 years ago 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).

comment:3 Changed 11 years ago by sanjay

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

comment:4 Changed 11 years ago 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

comment:5 Changed 11 years ago by guest

comment:6 Changed 11 years ago by alberto

  • Milestone changed from 1.0b2 to 1.1

comment:7 Changed 11 years ago by alberto

  • Milestone changed from 1.1 to 1.0.1

comment:8 Changed 11 years ago by alberto

  • Owner changed from anonymous to alberto
  • Status changed from new to assigned

comment:9 Changed 11 years ago 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...

comment:10 Changed 11 years ago by alberto

  • Owner alberto deleted
  • Status changed from assigned to new

comment:11 Changed 11 years ago 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

Changed 11 years ago by guest

new patch to work with current 1.0 branch

comment:12 Changed 11 years ago 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

comment:13 Changed 11 years ago by alberto

  • Status changed from assigned to closed
  • Resolution set to fixed

Comitted at [2404]. Thanks! :)

Alberto

comment:14 Changed 10 years ago by vhata

  • Status changed from closed to reopened
  • Resolution fixed 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.

Changed 10 years ago by vhata

Changed 10 years ago by vhata

comment:15 Changed 10 years ago 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?

comment:16 Changed 10 years ago by faide

  • Milestone changed from 1.0.1 to 1.1

comment:17 Changed 9 years ago by faide

  • Description modified (diff)
  • Milestone changed from 1.1 to 1.1.1

comment:18 Changed 9 years ago by faide

  • Milestone changed from 1.6 to 1.5

comment:19 Changed 8 years ago by Chris Arndt

  • Status changed from reopened to closed
  • Resolution set to invalid

Cruft ticket. Paginate was seriously refactored after the patches here were created. Closing ticket as invalid.

Note: See TracTickets for help on using tickets.