Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Pagination and tg.strict_parameters
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
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
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
King Simon-NFHD78  
View profile  
 More options Apr 5 2007, 6:52 am
From: "King Simon-NFHD78" <simon.k...@motorola.com>
Date: Thu, 5 Apr 2007 11:52:11 +0100
Local: Thurs, Apr 5 2007 6:52 am
Subject: Pagination and tg.strict_parameters

Hi,

(All this relates to TG 1.0.1)

The paginate decorator stops working when you switch from dev.cfg to a
config based on sample-prod.cfg. This seems to have caught people
before:

http://groups.google.com/group/turbogears/browse_thread/thread/11d1fa772
86eab6f/e0d41ce6cb53ab4a
http://trac.turbogears.org/ticket/845
http://trac.turbogears.org/ticket/1013

and seems to be down to these lines in controllers._execute_func:

    if config.get("tg.strict_parameters", False):
        tg_util.remove_keys(kw, ["tg_random", "tg_format"])
    else:
        args, kw = tg_util.adapt_call(func, args, kw)

ie. when tg.strict_parameters is False or undefined (the default in
sample-prod.cfg), then adapt_call is used to strip unknown parameters,
and that seems to include the pagination ones.

One workaraound is to enable tg.strict_parameters, but this may have
undesired effects in other parts of your application. Another is to add
**kwargs to the method that you want to paginate, which will cause
adapt_call to pass all arguments through, but this is a bit of a hack.

I don't know how to fix this in the general case - adapt_call would have
to be able to figure out the parameters that paginate requires, but
since paginate uses **kwargs that would be impossible. Perhaps if
paginate explicitly named its parameters, then adapt_call could do the
right thing?

The two attached files show the problem when added to the TurboGears
test suite.

Cheers,

Simon

  test_paginate_template.kid
< 1K Download

  test_paginate.py
3K Download

    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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