From: Joel Pearson <j...@pythonica.com>
Date: Wed, 14 Nov 2007 22:20:53 -0700
Local: Thurs, Nov 15 2007 12:20 am
Subject: Re: Paginate: sorting by multiple fields in default_order
Jorge Godoy wrote: I agree that a list is clearer; I used a string to avoid changing the data type > Em Wednesday 14 November 2007 03:41:17 Joel Pearson escreveu: >> @paginate("company", default_order="company.region,-company.billing_date") > I'd rather have a list here: of default_order. >> 2. If so, does this seem like a reasonable new definition of default_order? I see what you're saying-- allow default_order to be either: >> Old definition: "a single field name" >> New definition: "a single field name or a comma separated list of field >> names, where each field name is optionally preceded by a dash (-) to >> indicate reverse order" > As I said, I prefer using a list to mean a list and a string when A) a string containing a single field name, or B) a list of strings that each contain a single field name and then use "isinstance" to process each case accordingly. Good idea. I've updated my code to reflect that change. >> The ability to reverse the ordering from within "default_order" makes the Actually, I was thinking that default_reversed could be eliminated entirely in >> "default_reversed" parameter effectively unnecessary. However, for the sake >> of compatibility I left it in, and made sure that all combinations of >> default_reversed (True or False) and having a leading dash (or not) in >> default_order work as expected. > Did you also made it a list? Because if we have more than one value, then > Or it should check if there's just one "order" column, while raising an some future release (like 1.1 or 2.0, not 1.0.4). I prefer these: @paginate('table', default_order='-field1') to these: @paginate('table', default_order='field1', default_reversed=True) If default_reversed was going away in a future release, it could remain a The only use case I can think of for expanding default_reversed into a list is # what's the actual order? along with the additional logic in paginate.py to calculate the actual sort All things considered, I'd prefer to (eventually) phase out default_reversed, - Joel 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.
| ||||||||||||||