Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Index function and sub resources
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
  4 messages - 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
 
Voltron  
View profile  
 More options Jun 20, 9:05 am
From: Voltron <nhy...@googlemail.com>
Date: Sat, 20 Jun 2009 06:05:06 -0700 (PDT)
Local: Sat, Jun 20 2009 9:05 am
Subject: Index function and sub resources
I am trying to conditonally return a resource from the index page. I
noticed that any other URL results in a 404:

# Snippet

@cherrypy.expose

class User:
    def index(self, id = none):
        if  id:
            ...
        else:
            return "User not found"

So calls to /user work, but calls like "user/2" fail. Does the index()
function behave differently?

Thanks


    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.
Voltron  
View profile  
 More options Jun 20, 9:46 am
From: Voltron <nhy...@googlemail.com>
Date: Sat, 20 Jun 2009 06:46:26 -0700 (PDT)
Local: Sat, Jun 20 2009 9:46 am
Subject: Re: Index function and sub resources
I just noticed that calls like:

"user?ide=2" work, is this a bug?

Thanks


    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.
Voltron  
View profile  
 More options Jun 20, 10:27 am
From: Voltron <nhy...@googlemail.com>
Date: Sat, 20 Jun 2009 07:27:30 -0700 (PDT)
Local: Sat, Jun 20 2009 10:27 am
Subject: Re: Index function and sub resources
After a little more researching, I moved the sub resource variable to
the "default()" handler, now it works as expected. Is this correct way
to handle this problem? I did not find any documentation on this.

Thanks

On Jun 20, 3:46 pm, Voltron <nhy...@googlemail.com> wrote:


    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.
fumanchu  
View profile  
 More options Jun 20, 11:09 am
From: fumanchu <fuman...@aminus.org>
Date: Sat, 20 Jun 2009 08:09:17 -0700 (PDT)
Local: Sat, Jun 20 2009 11:09 am
Subject: Re: Index function and sub resources
On Jun 20, 6:05 am, Voltron <nhy...@googlemail.com> wrote:

Yes, the index method does behave differently. It is the only function
which cannot take positional arguments. This is mentioned indirectly
in http://www.cherrypy.org/wiki/CherryPyTutorial#Partialmatchesandthedef...
-- could use better docs.

Robert Brewer
fuman...@aminus.org


    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