Google Groups Home
Help | Sign in
Message from discussion Paginate: sorting by multiple fields in default_order
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Joel Pearson  
View profile
 More options Nov 20 2007, 8:20 pm
From: Joel Pearson <j...@pythonica.com>
Date: Tue, 20 Nov 2007 18:20:11 -0700
Local: Tues, Nov 20 2007 8:20 pm
Subject: [TurboGears] Paginate: sorting by multiple fields in default_order

Roger Demetrescu wrote:
> Have you any news on this ?
> I'd really like to see this feature in TG 1.0.4....  ;)

> If you can quickly fill a ticket with your patch, we can ask Florent
> to wait a couple of hours more before releasing 1.0.4b3 ...

> And don't worry about tests. I can code them before applying your patch...   :)

Sorry for the delay. I just went to re-create the patch against the current
version, but I won't be able to finish merging my changes for another 6 hours
or so, due to prior commitments. Also, I didn't mention previously that my
current version alters the appearance of the URL variable *_tgp_ordering from
being a URL-encoded dict to being a simple comma-separated list of field names
in sort order, with optional leading dashes on each field name to indicate
reversed order. (Note: I didn't change any internal data structures, just how
the URL is produced in get_href() and how it is parsed in convert_order().)

Thus, what previously looked like this (in the URL):

company_tgp_ordering=%7B%27state%27%3A%20%5B1%2C%20True%5D%2C%20u%27city%27 %3A%20%5B0%2C%20True%5D%7D

now looks like this:

company_tgp_ordering=state,city

This would break any existing bookmarks, but it would be easy enough to add
back in code to detect the old format, if desired. For that matter, I could
just throw out that part of the code and use the old format.

I'll open the ticket once the patch is ready. Let me know what to do about  the
_tgp_ordering variable. Thanks.

- Joel
--
Joel Pearson


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google